Hi, I want to set up a CALLBACK function in a delphi code so that from a C++ dll I can call it; As of now I wrote following code:
program Project1;
uses
Windows;
var
fnSomeDllMethod:procedure() cdecl;
m_hDll: HMODULE;
type
TCALLBACKPROC = function(arg:Pointer):HRESULT stdcall;
type
TSetCallbackFunc = procedure(_proc:TCALLBACKPROC) cdecl;
var
fnSetCallback:TSetCallbackFunc;
function CallbackProc(wEvent:DWORD;arg:Pointer;pParam:Pointer):HRESULT stdcall;
begin
MessageBoxA(0,'delphi', 'delphi',MB_OK);
end;
begin
begin
begin
m_hDll := LoadLibrary('DLLMsgBox.dll');
fnSetCallback := GetProcAddress(m_hDll,'DisplayInMessageBox');
fnSetCallback(CallbackProc);
FreeLibrary(m_hDll);
end;
end;
end.
It is giving error as :[Error] Project1.dpr(30): Incompatible types: 'Pointer' and 'Cardinal'
Can any one help me?
Thanks