Einzelnen Beitrag anzeigen

Benutzerbild von sieppl
sieppl

Registriert seit: 15. Aug 2004
Ort: Münster
198 Beiträge
 
Delphi 7 Professional
 
#1

Einbinden einer DLL-Funktion klappt nicht

  Alt 14. Mai 2006, 19:27
Hi!

Ich bin schon wieder zu doof um eine DLL-Funktion korrekt einzubinden. Habe schon einen Haufen von Funktionen gemappt, die alle funktionieren. An dieser scheitere ich:

Code:
[C++]
void IS3CALL _IS3SetCallback(
    ISCALLBACKPTR pCallback,
    UINT32 uUserData);
Code:
The callback function must be a function of this type :

      BOOL MyCallbackFunction(const UINT32 uCurRow,
                              const UINT32 uTotalRows,
                              const UINT32 uUserData)
      {
         if (time to quit)
         {
            return FALSE;
         }
         return TRUE;
      }

Set it with:

      IS3SetCallback(MyCallbackFunction, uUserData);
Aha, also mache ich:
Delphi-Quellcode:
interface
//...
TIS3Callback = function(const uCurRow: UINT; const uTotalRows: UINT; const uUserData: UINT): BOOL of object;
procedure IS3SetCallback(CallBack: TIS3Callback; UserData: UINT); stdcall;
//..
implementation
//..
procedure IS3SetCallback; external IS3Dll name '_IS3SetCallback';
In meiner Klasse dann:
Delphi-Quellcode:
private
//..
function CallBackFunc(const uCurRow: UINT; const uTotalRows: UINT; const uUserData: UINT): BOOL;
und später:
IS3SetCallback(CallBackFunc, 0); Wenn anschließend die DLL anfängz zu arbeiten gibt es einen Fehler 'Priviligierte Anweisung'. Ohne das Setzen des Callbacks passiert das nicht. (Um andere Fehler auszuschließen)

Kann mir jemand helfen? Danke!

Grüße

Sebastian
Sebastian
  Mit Zitat antworten Zitat