• Advertisement
Sign in to follow this  

DirectPlay Client

This topic is 4796 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Advertisement
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 component
if(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 component
if(FAILED(g_pDPClient->Initialize(NULL, NetMsgHandler, 0)))
return FALSE;

return TRUE;
}




did ya set your IDirectPlay8Client* to NULL when you initialize?

Share this post


Link to post
Share on other sites
sheet... i never initialised com... I'm going blind or something. I vdiffed the two source files 10000 times ;)

thanks :)

Share this post


Link to post
Share on other sites
heh very easy to forget, ive done it enough to wonder about myself. :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement