AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Win32/Win64 API (native code) Delphi Dll-Aufruf Konvertierung von VB-Code nach Delphi
Thema durchsuchen
Ansicht
Themen-Optionen

Dll-Aufruf Konvertierung von VB-Code nach Delphi

Ein Thema von Funky-Sepp · begonnen am 15. Dez 2003 · letzter Beitrag vom 15. Dez 2003
 
Funky-Sepp

Registriert seit: 14. Okt 2003
Ort: Freudenricht/Velburg
56 Beiträge
 
#1

Dll-Aufruf Konvertierung von VB-Code nach Delphi

  Alt 15. Dez 2003, 15:55
Hi @All!

ich habe diesen Code
Code:
Public Enum eMode
  CommonMode = 0
  IMode_1 = 1
  IMode_2 = 2
  IMode_3 = 3
  IMode_4 = 4
  IMode_5 = 5
  SimpleMode = 6
End Enum

Declare Sub SetDeviceEnabled Lib "AN21xx.dll" (ByVal DevNumber As Byte, _
                                              ByVal DriverName As String, _
                                              ByVal MC_Mode As eMode, _
                                              ByVal ID As String, _
                                              ByVal KeyWord As String, _
                                              I_Error As Long)
von einem VB-Beispiel genommen und wollte ihn in Delphicode umwandeln,
aber irgendwas mach ich falsch:

Delphi-Quellcode:

const
  CommonMode = 0;
  IMode_1 = 1;
  IMode_2 = 2;
  IMode_3 = 3;
  IMode_4 = 4;
  SimpleMode = 5;



type TDLL_AN21xx_SetDeviceEnabled = procedure( const aDevNumber : Byte;
                                               const aDriverName : PChar;
                                               const aMC_Mode : integer;
                                               const aID : PChar;
                                               const aKeyWord : PChar;
                                               var aError : integer
                                             );

var DLL_AN21xx_SetDeviceEnabled : TDLL_AN21xx_SetDeviceEnabled = nil;

function DLL_An21xx_Init : Boolean;

implementation


function DLL_An21xx_init : Boolean;
var a : Cardinal;
begin
  a := LoadLibrary(pChar(ExtractFilePath( Application.exename) + 'AN21xx.dll'));
  @DLL_AN21xx_SetDeviceEnabled := GetProcAddress (a,'SetDeviceEnabled');
  if @DLL_AN21xx_SetDeviceEnabled = nil then Result := false else Result := true;
end;
ich komme einfach nicht drauf.

immer wenn ich dann die Proceduer DLL_AN21xx_SetDeviceEnabled aufrufe kommt eine Zugriffsverletzung. Also muss irgendein parameter falsch sein?

Hoffe ihr könnt mir weiterhelfen.

Danke schonmal im voraus.

Wolfgang
Wolfgang
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 20:33 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz