Original Post
Hello, I'm writing an app that needs to run both on single and multiple monitor setups. I am trying to call DirectDrawEnumerateEx() to enumerate valid DDraw devices, and from that decide if I'm on a single or multiple monitor machine and create my DirectDraw objects from the GUIDs in the latter case. The problem is that my callback never gets called. Here's the relevant code snippets: The call to DirectDrawEnumerateEx:
if (DirectDrawEnumerateEx(DDEnumCallback, NULL,
DDENUM_ATTACHEDSECONDARYDEVICES |
DDENUM_DETACHEDSECONDARYDEVICES |
DDENUM_NONDISPLAYDEVICES) != DD_OK)
{
AfxMessageBox(_T("Failed to enumerate DirectDraw devices"));
}
The callback function itself:
BOOL WINAPI DDEnumCallback(GUID FAR* lpGUID, LPWSTR lpDriverDescription,
LPWSTR lpDriverName, LPVOID lpContext, HMONITOR hm)
{
// Empty for now, to see if it's being called
log_message("Enumeration callback called.");
return DDENUMRET_OK;
}
The problem is that the messagebox is displayed (hence, the call to DirectDrawEnumerateEx returns something other than DD_OK) and the callback is never called. What could cause this? The DDENUM_ constants should be valid according to the docs, and I don't need anything in the lpContext parameter since my callback doesn't do anything (yet)... Any ideas? Thanks in advance, Skylark