Skip to main content
gamedev.net
🔒 Locked

DirectPlay Client

Started by ManTis Jan 4, 2005 at 3:34 PM 2 replies 500+ views
Original Post
ManTis
ManTis
Ok, i have this problem - I'm trying to initialize DirectPlay client, and CoCreateInstance fails. It works excellent in the example from which I am learning, and which I am compiling, but it won't work in my project. Anybody has any idea? This is the code: BOOL InitDP() { // Create DirectPlay Client component if(FAILED(CoCreateInstance( CLSID_DirectPlay8Client, NULL, CLSCTX_INPROC_SERVER,IID_IDirectPlay8Client,(void**) &g_pDPClient))) { std::cerr << "InitDP failed\n"; return FALSE; } // Assign a message handler to network component if(FAILED(g_pDPClient->Initialize(NULL, NetMsgHandler, 0))) return FALSE; return TRUE; } Please help, regards.
If only noobs were boobs... the world would be a better place.
xsirxx
xsirxx
did ya initialize com?

hReturn = CoInitialize( NULL );


BOOL InitDP(){HRESULT hReturn;if( FAILED(hReturn = CoInitialize( NULL )) ){std::cerr << "Error Initializing COM\n";return FALSE;}// Create DirectPlay Client componentif(FAILED(hReturn = CoCreateInstance( CLSID_DirectPlay8Client, NULL, CLSCTX_INPROC_SERVER,IID_IDirectPlay8Client,(void**) &g_pDPClient))){ std::cerr << "InitDP failed\n"; return FALSE;}// Assign a message handler to network componentif(FAILED(g_pDPClient->Initialize(NULL, NetMsgHandler, 0)))return FALSE;return TRUE;}

did ya set your IDirectPlay8Client* to NULL when you initialize?
--X
ManTis
ManTis
sheet... i never initialised com... I'm going blind or something. I vdiffed the two source files 10000 times ;)

thanks :)
If only noobs were boobs... the world would be a better place.
xsirxx
xsirxx
heh very easy to forget, ive done it enough to wonder about myself. :)
--X

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.