Advertisement

On a DPlay 8.1 game chat program.. (new person on coding)

Started by October 20, 2005 10:28 AM
0 comments, last by TheOther 19 years, 3 months ago
Hello all! Im fresh on DirectX game programming, just finishing my DDraw7 studies to move to study DPlay8.. Im on my game, chat program.. My chat will have graphics like on this site and DPlay8 p2p for connections.. I started with DPlay8.1 "TUT05_Send" and have added a Create Group/Players and Enum Group/Players functions on.. I have following problems :: 1).. i know how to create an group and how to enum ones, but im not sure if there is a true and false ways to do these operations, so, i added my code for advises.. void CGroup ( void ) // Function creates an DP8 group.. { HRESULT HR = NULL; DPN_GROUP_INFO DPN_Group_Info; PWSTR Nimi = (PWSTR)"MYGROUP"; ZeroMemory( &DPN_Group_Info, sizeof ( DPN_GROUP_INFO ) ); DPN_Group_Info.dwSize = sizeof ( DPN_GROUP_INFO ); DPN_Group_Info.pwszName = Nimi; DPN_Group_Info.dwGroupFlags = DPNGROUP_AUTODESTRUCT; DPN_Group_Info.dwInfoFlags = DPNINFO_NAME; DPN_Group_Info.dwDataSize = NULL; DPN_Group_Info.pvData = NULL; HR = g_pDP->CreateGroup ( &DPN_Group_Info,NULL,NULL,NULL,DPNCREATEGROUP_SYNC ); printf ("Group Created.\n"); if ( HR == S_OK ) printf ("SUCCESS!!.\n"); } void EGroup ( void ) // Function ENUMS just fine.. { long aa = 0; DPNID DPNIDS [2000]; DWORD LUKU = 20; for ( aa = 0; aa < 2000; ++aa ) DPNIDS [aa]=0; g_pDP->EnumPlayersAndGroups ( DPNIDS,&LUKU,DPNENUM_GROUPS ); for ( aa = 0; aa < 10; ++aa ) printf ("%x\n",DPNIDS[aa] ); printf ("%x\n",LUKU ); } 2).. Is it possible to create more than one player to one computer with DP8 i have a similiar code than i had with groups to my players, code for ENUM is working properly, but my code for CREATING is not, what is my fault ?? void CPlayer ( void ) // this function is not working properly.. { HRESULT HR = NULL; DPN_PLAYER_INFO DPN_Player_Info; PWSTR Nimi = (PWSTR)"MY NAME"; ZeroMemory( &DPN_Player_Info, sizeof ( DPN_PLAYER_INFO ) ); DPN_Player_Info.dwSize = sizeof ( DPN_PLAYER_INFO ); DPN_Player_Info.pwszName = Nimi; DPN_Player_Info.dwPlayerFlags = NULL; DPN_Player_Info.dwDataSize = 0; DPN_Player_Info.pvData = NULL; DPN_Player_Info.dwInfoFlags = DPNINFO_NAME; HR = g_pDP->SetPeerInfo ( &DPN_Player_Info,NULL,NULL,DPNSETPEERINFO_SYNC ); printf ("Player Created.\n"); if ( HR == S_OK ) printf ("SUCCESS!!.\n"); } void EPlayer ( void ) // this function works fine.. { long aa = 0; DPNID DPNIDS [2000]; DWORD LUKU = 20; for ( aa = 0; aa < 2000; ++aa ) DPNIDS [aa]=0; g_pDP->EnumPlayersAndGroups ( DPNIDS,&LUKU,DPNENUM_PLAYERS ); for ( aa = 0; aa < 10; ++aa ) printf ("%x\n",DPNIDS[aa] ); printf ("%x\n",LUKU ); } 3).. How do i set an CONST WCHAR string?? What is wrong with my code ?? WCHAR *wszHost = (WCHAR*)"JARISADDRESS.COM"; it compiles without an error. 4).. There is an option for max players on DPN_APPLICATION_DESC but how do i set an max members on a GROUP ?? 5).. I have an ADSL 1m/512k connection, if i make an p2p chat, how many max users i can set to my server program with my connection speed..
Quote:
Original post by JariTapio


3).. How do i set an CONST WCHAR string??
What is wrong with my code ??
WCHAR *wszHost = (WCHAR*)"JARISADDRESS.COM";
it compiles without an error.


Have you tried using the L helper/token?

//this assignment uses the MS standard L to convert//the string into a WCHARWCHAR *wszHost = L"JARISADDRESS.COM";//here's another way!//I think it needs tchar.h but I'm not 100%WCHAR *wszHost = TEXT("JARISADDRESS.COM");


I've used both ways in my code for happiness.

This topic is closed to new replies.

Advertisement