Post Reply

Forums -> Multiple monitors -> EnumDisplayMonitors bug
Rich   2004-04-14 07:57
Has anyone noticed a bug with EnumDisplayMonitors? When using this api to draw something, drag another window over it and it doesn't properly redraw! Note that you must have the property "show window contents while dragging" turned on. I've narrowed it down to a couple lines in the most basic Windows app. In the message loop:

case WM_PAINT:
hdc = BeginPaint(hWnd, &ps);
::EnumDisplayMonitors(hdc, NULL, DrawEnumProc, (LPARAM)&hdc);
EndPaint(hWnd, &ps);
break;

and the callback function:

BOOL CALLBACK DrawEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData)
{
HDC *pdc = (HDC*)dwData;

Sleep(10); // this pretends you're doing something

HBRUSH hbr = CreateSolidBrush(0x00c0c000);
// FillRect(*pdc, lprcMonitor, hbr);
FillRect(hdcMonitor, lprcMonitor, hbr);
DeleteObject(hbr);

return TRUE;
}

This shows the problem, but if you switch to the other FillRect that uses the original DC, there is no problem!

Does anyone have an idea???

Thanks for any help!
Rich
Roland4269   2011-10-10 05:56
I don't know the answer to your inquiry, but this piece resolved my issue. No matter what I did, and following MS's EnumDisplayMonitors exactly, anything I rendered to the 2nd monitor would be black. Thanks to this line in your code:
HDC *pdc = (HDC*)dwData;
I'm now working. Thanks!
carlosgucci777   2026-03-24 03:49
Hey! Someone in my discord group shared a link to this site and I decided to hop on. I was really interested in the poker tournaments they have running. While using delta online casino [url=https://deltacasinoonline.cloud/]https://deltacasinoonline.cloud/[/url] I realized how much I had been missing out on other platforms. The slots online are also quite fun and I left my session feeling very satisfied. It is a solid option for anyone living in Canada looking for quality bets.
Forums -> Multiple monitors -> EnumDisplayMonitors bug

Post Reply