Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

ziplux

DirectPlay

This topic is 6496 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

Whenever I call Open(...) to create a new session, it gives me the error DPERR_UNINITIALIZED. Does anyone know what that means or how I can fix it? Here is the function and the Init function too. Thanks in advance.
    
int CDPlayServer :: StartServer(char *name)
	{
	DPSESSIONDESC2   dpsd;    // session desc

	HRESULT hr;

	ZeroMemory( &dpsd, sizeof(dpsd) );
	dpsd.dwSize           = sizeof(dpsd);
	dpsd.guidApplication = TicTacToeApp;
	dpsd.dwMaxPlayers     = 2;

	dpsd.dwFlags          = DPSESSION_DIRECTPLAYPROTOCOL;

	if(FAILED(hr = lpdp->Open( &dpsd, DPOPEN_CREATE )))  // fails here

		{
		switch (hr)
			{
			case DPERR_UNINITIALIZED:
				{
				cout << "Err"; // this is printed

				} break;
			default:break;
			}
		return FAIL;
		}
	CPlayer p;
	sprintf("HOST", p.name);
	CreateLocalPlayer(p);
	return SUCCESS;
	}
[/source]
[source]
int CDPlay :: Init()
	{
	LPDIRECTPLAYLOBBYA        old_lpdplobbyA = NULL;    // old lobby pointer

	
	CoInitialize(NULL);    // registering COM

	CO_UsedBy++;

    // creating directplay object

    if  ( CoCreateInstance(CLSID_DirectPlay, NULL, CLSCTX_INPROC_SERVER,
         IID_IDirectPlay4A,(LPVOID*)&lpdp ) != S_OK)
		{
        // return  a messagebox error

        CoUninitialize();   // unregister the comp

        return(0);
		}

    // creating lobby object

    DirectPlayLobbyCreate(NULL, &old_lpdplobbyA, NULL, NULL, 0);

    // get new interface of lobby

    old_lpdplobbyA->QueryInterface(IID_IDirectPlayLobby3A, (LPVOID *)&lpdplobby);
    old_lpdplobbyA->Release();   // release old interface since we have new one

	return SUCCESS;
	}
    
My Geekcode: "GCS d s: a14 C++$ P+(++) L+ E-- W+++$ K- w++(+++) O---- M-- Y-- PGP- t X R- tv+ b++ DI+(+++) D- G e* h!" Decode my geekcode! Geekcode.com
Visit our web site: Asylum Entertainment

Share this post


Link to post
Share on other sites
Advertisement

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!