PPT Slide
//Look for a Hello World Session which might be already running
static HRESULT FindSession()
DPSESSIONDESC sessionDesc;
ZeroMemory(&sessionDesc, sizeof(DPSESSIONDESC));
sessionDesc.dwSize = sizeof(DPSESSIONDESC);
sessionDesc.guidSession = sessionGUID;
hr = lpDirectPlay1->EnumSessions(&sessionDesc, 1000, EnumSessionsCallback,
hwndApp, DPENUMSESSIONS_AVAILABLE);
::MessageBox(NULL,"Could not find any HelloWorld sessions", "HelloWorld", MB_OK);
// Callback function for enumerating sessions
static BOOL FAR PASCAL EnumSessionsCallback(
LPDPSESSIONDESC lpSessionDesc,
if (dwFlags & DPESC_TIMEDOUT)
::MessageBox(NULL,"Could not find a HelloWorld session!....Timed Out", "HelloWorld", MB_OK);
::MessageBox(NULL,"Found a HelloWorld session!", "HelloWorld", MB_OK);
Enumerates other DirectPlay
is called by DirectPlay for each session it finds.