1 | // Callback function for enumerating service providers |
2 | static BOOL FAR PASCAL DirectPlayEnumerateCallback( |
3 | LPGUID lpSPGuid, |
4 | LPTSTR lpszSPName, |
5 | DWORD dwMajorVersion, |
6 | DWORD dwMinorVersion, |
7 | LPVOID lpContext |
8 | ) |
9 | { |
10 | //Look for the TCP/IP service provider for DirectPlay |
11 | if (strstr( lpszSPName, "TCP") != NULL) |
12 | { |
13 | // Make space for the service provider's GUID. |
14 | lpServiceProviderGuid = new GUID; |
15 | if (lpServiceProviderGuid == NULL) //If memory could not be allocated |
16 | ::MessageBox(NULL,"Could not allocate memory for service provider's GUID", |
17 | "HelloWorld", MB_OK); |
18 | else |
19 | *lpServiceProviderGuid = *lpSPGuid; // Store the GUID of the service provider |
20 | return(FALSE); //Returning false stops further enumeration |
21 | //Since we found our service provider, we return false |
22 | } |
23 | return(TRUE); //Continue enumeration |
24 | } |
25 | DirectPlayEnumerateCallback(): |
26 | DirectPlay calls this function for each |
27 | service provider it detects on the machine |