Einzelnen Beitrag anzeigen

Hedge

Registriert seit: 30. Jun 2007
278 Beiträge
 
Delphi 2009 Professional
 
#1

Incompatible types: 'Cardinal' and 'Pointer' bei DLL-Aufruf

  Alt 8. Sep 2008, 00:22
Möchte die Funktion einer DLL benutzen. Der Author hat diese folgendermaßen dokumentiert:

Zitat:
DWORD SetCallback(IN DWORD lpProc);
--- lpProc: pointer to the callback function:
--- VOID WINAPI keyProc(INT pressedKeys);
---
--- In VB: SetCallback(AddressOf(Keys_Pressed))
--- Public Sub Keys_Pressed(Keys as Long) .....


If the functions succeed, the return value is nonzero.
If the functions fails, the return value is zero. To get extended error information, call GetLastError.

I attached it and hope u can find use with it.

The values.txt showes, what to check for at the callback.
Any questions, just ask!
Im var-Bereich meines Forms habe ich deklariert:

Delphi-Quellcode:
function SetCallback (lpProc: DWORD ) : dword;stdcall;
  external 'lglight.dll';
mit anderen Funktionen der dll kann ich arbeiten, aber bei dieser versteh ich den Umgang damit nicht.
Dann habe ich im Form.Create:

SetCallback (@keyProc); Hier tritt der im Titel erwähnte Fehler auf

Und weiter vorne

Delphi-Quellcode:
function keyProc(pressedKeys:integer):integer;
begin
 beep;
end;
  Mit Zitat antworten Zitat