This code allows the user to select which video card to use if there are more than one present.
static GUID *gpSelectedDriverGUID;
BOOL WINAPI Callback(
GUID FAR *lpGUID,
LPSTR lpDriverDescription,
LPSTR lpDriverName,
LPVOID lpContext,
HMONITOR hm
)
{
char buffer[256];
if (lpGUID)
{
wsprintf(buffer, "Use the %hs video card?", lpDriverDescription);
if (MessageBoxEx(NULL, buffer, "Avoidance", MB_YESNO, NULL) == IDYES)
{
gpSelectedDriverGUID=lpGUID;
return DDENUMRET_CANCEL;
}
}
return DDENUMRET_OK;
}
And to use the routine in your code:
DirectDrawEnumerateExA(Callback, NULL, DDENUM_ATTACHEDSECONDARYDEVICES |
DDENUM_NONDISPLAYDEVICES | DDENUM_DETACHEDSECONDARYDEVICES);
if (!gpSelectedDriverGUID)
gpSelectedDriverGUID = NULL;
Then when creating the DirectDraw object just call it like this:
DirectDrawCreate(gpSelectedDriverGUID, &lpdd, NULL);