Multiple Monitor Support Code
by David Stubbs

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

Discuss this article in the forums


Date this article was posted to GameDev.net: 8/15/2000
(Note that this date does not necessarily correspond to the date the article was written)

See Also:
General
Sweet Snippets

© 1999-2011 Gamedev.net. All rights reserved. Terms of Use Privacy Policy
Comments? Questions? Feedback? Click here!