Click to open or copy the files for the DPslots sample.
This sample demonstrates how to build a client/server application using DirectPlay.
DPslots is really two applications in one. When you host a session, it acts as a server. The server maintains a simple database of account balances for every user that is allowed to log in. Clients can request their current balance from the server and can request that the server spin the wheels and calculate the amount won or lost.
Visual C++ may include older versions of the DirectX header files and libraries. This sample requires DirectX 5. In order to avoid compile errors, make sure the path to the DirectX 5 header files and libraries is listed BEFORE the Visual C++ header files and libraries on the Directories menu, found under Options on the Tools menu.
This sample uses the following keywords:
_strupr; atoi; bitblt; checkdlgitem; clientapplicationmessage; clientloginwndproc; clientsystemmessage; clientwndproc; closeaccountdb; closehandle; cocreateinstance; coinitialize; connect; connectusingdialog; connectusinglobby; connectwndproc; couninitialize; createcompatibledc; createdirectplayinterface; createevent; createplayer; createthread; define_guid; deleteconnectionlist; deletedc; deleteobject; deletesessioninstancelist; destroydirectplayinterface; destroyplayer; dialogboxparam; directplayenumconnectionscallback; dlgitemischecked; drawwheels; enabledlgbutton; enablewindow; enddialog; enumconnections; enumsessions; enumsessionscallback; errorbox; exitthread; failed; fclose; fgets; fopen; fputs; fseek; getaccountdesc; getamountwonorlost; getclientlogin; getcomputername; getconnection; getconnectionsettings; getdlgitem; getdlgitemtext; getplayeraccount; getplayername; getrecord; getsecureaccountdesc; getserverconfig; getsessiondesc; getsessioninstanceguid; gettickcount; getunsecureaccountdesc; getusername; getwindowdc; getwindowrect; globalallocptr; globalfreeptr; handleapplicationmessage; handlebalancerequest; handlespinrequest; handlesystemmessage; hostsession; initializeclientloginwindow; initializeconnection; initializeserverconfigwindow; isequalguid; joinsession; killtimer; loadbitmap; logrequest; lstrcpy; lstrlen; makeintresource; memcpy; messagebox; offsetrect; openaccountdb; paintbitmap; playsound; postmessage; putrecord; queryaccount; queryinterface; rand; receive; receivemessage; receivethread; rectheight; rectwidth; release; rewind; saveclientlogin; saveserverconfig; secureopen; selectobject; selectsessioninstance; send; sendbalancerequest; senddlgitemmessage; sendflags; sendspinrequest; serverapplicationmessage; serverconfigwndproc; serversystemmessage; serverwndproc; sessionflags; setconnectionsettings; setdlgitemtext; setevent; setrect; settimer; setupconnection; shutdownconnection; spinwheels; sprintf; srand; startspinning; strcpy; stretchblt; strncmp; strtok; succeeded; switch; updateaccount; waitformultipleobjects; waitforsingleobject; winmain; wsprintf; zeromemory