vgo
07-04-2005, 04:58 PM
I already posted this message on the gamedev.net forums, but I'm gonna try my luck here too. :)
I downloaded the Clootie's DirectX 9 header conversions and wanted to try out the DirectPlay stuff, but I ran into problems with my message handling callback routine.
Here's my callback routine:
function TDirectPlayServer.DPMessageHandler(pvUserContext: Pointer; dwMessageType: DWORD; pMessage: Pointer): HRESULT; stdcall;
begin
Result := S_OK;
end;
I try to use it like this (like I've done with the Windows API callbacks before):
...
hr := DPServer.Initialize(NIL, @DPMessageHandler, 0);
...
The problems is that my code won't compile, the error message that I get is "Variable required".
The initialize function is declared like this:
function Initialize(pvUserContext: Pointer; pfn: TFNDPNMessageHandler; dwFlags: DWORD): HResult; stdcall;
And the callback is declared like this:
TFNDPNMessageHandler = function (pvUserContext: Pointer; dwMessageType: DWORD; pMessage: Pointer): HRESULT; stdcall;
{$NODEFINE TFNDPNMessageHandler}
{$HPPEMIT 'typedef PFNDPNMESSAGEHANDLER TFNDPNMessageHandler;'}
I can easily set the handler if I declare it outside the class like this:
function DirectPlayMessageHandler(pvUserContext: Pointer; dwMessageType: DWORD; pMessage: Pointer): HRESULT; stdcall;
begin
Result := S_OK;
end;
But it's kinda useless, because I can't access the private methods/variables on my server class. :)
The solution is simple, but I just can't grasp it right now. :P
Any help greatly appreciated.
I downloaded the Clootie's DirectX 9 header conversions and wanted to try out the DirectPlay stuff, but I ran into problems with my message handling callback routine.
Here's my callback routine:
function TDirectPlayServer.DPMessageHandler(pvUserContext: Pointer; dwMessageType: DWORD; pMessage: Pointer): HRESULT; stdcall;
begin
Result := S_OK;
end;
I try to use it like this (like I've done with the Windows API callbacks before):
...
hr := DPServer.Initialize(NIL, @DPMessageHandler, 0);
...
The problems is that my code won't compile, the error message that I get is "Variable required".
The initialize function is declared like this:
function Initialize(pvUserContext: Pointer; pfn: TFNDPNMessageHandler; dwFlags: DWORD): HResult; stdcall;
And the callback is declared like this:
TFNDPNMessageHandler = function (pvUserContext: Pointer; dwMessageType: DWORD; pMessage: Pointer): HRESULT; stdcall;
{$NODEFINE TFNDPNMessageHandler}
{$HPPEMIT 'typedef PFNDPNMESSAGEHANDLER TFNDPNMessageHandler;'}
I can easily set the handler if I declare it outside the class like this:
function DirectPlayMessageHandler(pvUserContext: Pointer; dwMessageType: DWORD; pMessage: Pointer): HRESULT; stdcall;
begin
Result := S_OK;
end;
But it's kinda useless, because I can't access the private methods/variables on my server class. :)
The solution is simple, but I just can't grasp it right now. :P
Any help greatly appreciated.