// Callback function for enumerating service providers |
static BOOL FAR PASCAL DirectPlayEnumerateCallback( |
LPGUID lpSPGuid, |
LPTSTR lpszSPName, |
DWORD dwMajorVersion, |
DWORD dwMinorVersion, |
LPVOID lpContext |
) |
{ |
//Look for the TCP/IP service provider for DirectPlay |
if (strstr( lpszSPName, "TCP") != NULL) |
{ |
// Make space for the service provider's GUID. |
lpServiceProviderGuid = new GUID; |
if (lpServiceProviderGuid == NULL) //If memory could not be allocated |
::MessageBox(NULL,"Could not allocate memory for service provider's GUID", |
"HelloWorld", MB_OK); |
else |
*lpServiceProviderGuid = *lpSPGuid; // Store the GUID of the service provider |
return(FALSE); //Returning false stops further enumeration |
//Since we found our service provider, we return false |
} |
return(TRUE); //Continue enumeration |
} |
DirectPlayEnumerateCallback(): |
DirectPlay calls this function for each |
service provider it detects on the machine |