// Here''s the relevant tutorial code
HRESULT WINAPI DirectPlayMessageHandler(PVOID pvUserContext, DWORD dwMessageId, PVOID pMsgBuffer);
...
g_pDPServer->Initialize(NULL, DirectPlayMessageHandler, 0 ); // This is the message handler
-------------------------------------------------------------
// Here''s my relevant code
class Network
{
public:
...
HRESULT WINAPI DirectPlayMsgHandler( PVOID pvUserContext, DWORD dwMessageId, PVOID pMsgBuffer );
...
IDirectPlay8Server* m_pDPServer;
}
...
m_pDPServer->Initialize( NULL, DirectPlayMsgHandler, 0 );
Problem registering a callback function in DirectPlay
I am a newbie in DirectPlay and am following some tutorials on MSDN (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dx8_c/directx_cpp/Play/CPP_Tut/Tutorial9_ClientServer.asp) to add some simple server/client networking to my game. Everything made sense and I added it without any trouble except for registering a callback for my message handler. I can compile and run the tutorial project with no problems but the same code copied and pasted into my own project does not work.
Here''s what I have:
The error message I get is: error C2664: ''Initialize'' : cannot convert parameter 2 from ''long (void *,unsigned long,void *)'' to ''long (__stdcall *const )(void *,unsigned long,void *)''
None of the functions with this name in scope match the target type
What is wrong with this? The only difference is that my code uses classes. The callback function help page on msdn (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dx8_c/directx_cpp/Play/Using/ImplementingCallbackFunction.asp) doesn''t tell me anything I don''t already know.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement