Jump to content


Multiple Monitor Support Code

----- By David Stubbs | Published Aug 15 2000 02:50 PM in Game Programming


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);


Compare Revision Date Title Editor
2 Jun 14 2011 10:10 AM Gaiiden
1 Jun 14 2011 10:09 AM Gaiiden
PARTNERS