Jump to content
  • Advertisement
Sign in to follow this  
ManTis

DirectPlay Client

This topic is 4976 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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!