Skip to main content
gamedev.net
🔒 Locked

DirectPlay problem

Started by Ilici Apr 18, 2003 at 1:46 PM 6 replies 2.3k views
Original Post
Ilici
Ilici
the directX forum is not into dplay so i took this here: i''m using the old style DirectPlayCreate(..) to init DPlay before i do the DirectPlayEnumarate(...) 2 get the guids. after i get the guids, i cannot init Dplay with DirectPlayCreate(...) it gives me DPERR_UNAVAILABLE here is the code
  
include "log.h"

#pragma comment (lib, "dplay.lib")
#pragma comment (lib, "dplayx.lib")
#pragma comment (lib, "dxguid.lib")

LPDIRECTPLAY	dp;

bool	mpIPX		= false;
bool	mpTCPIP		= false;
bool	mpSERIAL	= false;
bool	mpMODEM		= false;

GUID	mpIPXguid;
GUID	mpTCPIPguid;
GUID	mpSERIALguid;
GUID	mpMODEMguid;

BOOL FAR PASCAL mpEnumConnections( 
    LPGUID      lpguidSP,
    LPSTR       lpSPName,
    DWORD       dwMajorVersion,     
    DWORD       dwMinorVersion,
    LPVOID      lpContext)
{

	if (strcmp(lpSPName, "IPX Connection For DirectPlay") == 0)
	{
		mpIPX = true;
		mpIPXguid = *lpguidSP;
		return TRUE;
	}

	if (strcmp(lpSPName, "Internet TCP/IP Connection For DirectPlay") == 0)
	{
		mpTCPIP = true;
		mpTCPIPguid = *lpguidSP;
		return TRUE;
	}

	if (strcmp(lpSPName, "Modem Connection For DirectPlay") == 0)
	{
		mpMODEM = true;
		mpMODEMguid = *lpguidSP;
		return TRUE;
	}

	if (strcmp(lpSPName, "Serial Connection For DirectPlay") == 0)
	{
		mpSERIAL = true;
		mpSERIALguid = *lpguidSP;
		return TRUE;
	}
	return TRUE;
}

int mpGetConnections()
{
	int hr;

	hr = DirectPlayEnumerate(mpEnumConnections, 0);

	if (hr)
	{
		lprintf("Cannot Enumerate SPs\n");
		return SYS_ERR;
	}

	return SYS_OK;
}

int mpInitialize()
{
	if (mpGetConnections()) return SYS_ERR;

	int hr = DirectPlayCreate(&mpIPXguid, &dp, NULL);

	//{685BC400-9D2C-11cf-A9CD-00AA006886E3} GUID in registry and received from Enumerate


	if (hr != DP_OK)
	{
		switch (hr)
		{
			case CLASS_E_NOAGGREGATION :	lprintf("CLASS_E_NOAGGREGATION  "); break;
			case DPERR_EXCEPTION :			lprintf("DPERR_EXCEPTION  ");break;
			case DPERR_INVALIDPARAMS  :		lprintf("DPERR_INVALIDPARAMS  "); break;
			case DPERR_UNAVAILABLE :		lprintf("UNAVAIABLE CONNECTION"); break;
		}

		lprintf("Cannot initialize DirectPlay\n", hr);
		return SYS_ERR;
	}
	
	return SYS_OK;

}

  
i have DX9 i dont like the CoCreateInstance(...) it suxx coz it makes my app multi-threaded and stuff is there a prob with my code or is the damn DX?
Ilici
Ilici
i took the dx8 samples, compiled them and it doesnt work, but an already compiled sampel works
so.. i think there are problems with the .lib files
dplay.lib and dplayx.lib are from 1998 (;0) and i dont think they work

in the Dx8 sdk there isa only a newer dplayx.lib but not dplay.lib
do i have to update dplay.lib also?

i tried updating dplayx.lib but still it doesnt work

and about strcmp it works fine , i tried it on many computers and the Service PRov for dplay have the same names

again i dont want to use CoCreateInstance because for a simple class init it also stuffs me with 2 more threads for the app
Ilici
Ilici
ok i moved to dplay8 finally after finding out i cand use DirectPlay8Create

where can i get a decent DirectPlay8 tutorial ? coz dx8 sdk doesnt have tutorials just the code.

teh DX8 SDK samples are extremely stuffed with crap so i''m lookin 4 something simpler.
AikonIV
AikonIV
In the DX8 help file it gives some more info on the tutorials. I am using DirectPlay very well, and learned it all from the samples/tutorials. It''s not that hard, and eventually you can make a wrapper class for it to make it even easier.
kenjin
kenjin
Hi I"m trying to implement directplay using the sdk, but it won''t recognize the commands

CoInitializeEx(NULL, COINIT_MULTITHREADED);


I included all the files that they did in the .cpp of the documentatino. I added all the .lib files in the setting -> linker as well I don''t know if I''m missing something else its just not recognizing it. Can anyone help?
games rule
Ilici
Ilici
try DirectPlay8Create(..)

there are many DirectPlay8Create functions, look for them in the sdk

Topic Locked

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

Sign in to reply to this topic.