Post Reply
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!
|
Post Reply
|