Announcement

Collapse
No announcement yet.

Aufruf einer DLL Funktion in Delphi

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Aufruf einer DLL Funktion in Delphi

    Hallo
    kann mir bitte jemand weiterhelfen.

    Wie ruft man folgende DLL Funktion in Delphi auf:

    C
    NoMangle long DLL_IMPORT_EXPORT csp2GetDeviceId(char szDeviceId[8], long nMaxLength);

    In VB ist es so gemacht:

    Declare Function csp2GetDeviceId Lib "csp2.dll" (szDeviceId As Byte, ByVal nMaxLength As Long) As Long

    Private Sub CS1504InfoRefresh_Click()
    Dim arrbyteBuffer(19) As Byte '20 elements

    ' Get the device id..
    nRC = csp2GetDeviceId(arrbyteBuffer(0), 10)

    If nRC > 0 Then
    bstrString = "0x"
    ...

    Besten Dank

    Peter Würstle

  • #2
    function csp2GetDeviceId(szDeviceId: PChar; nMaxLength: Longint): Longint; stdcall; external 'csp2.dll' name 'csp2GetDeviceId';

    Ein bischen merkwuerdig ist die C Deklaration schon.
    Es wird ein 8-Zeichen-Puffer angegeben, aber trotzdem eine Laenge benoetigt. Das ist ein bischen inkonsequent.

    var
    Buffer: array [0..7] of Char;
    begin
    csp2GetDeviceId(@Buffer[0], SizeOf(Buffer))

    Comment


    • #3
      Danke für die schnelle Antwort.

      Gruß Pete

      Comment

      Working...
      X