I have a question about strangely originating WM_PAINT messages sent to my window. It happens on Windows 7 and doesn’t happen on Windows XP.
Details
In my program, I have a timer that triggers GUI updates, the timer is based on this API call:
CreateTimerQueueTimer
In the thread provided my the system to process timer expiration, I do some GUI updates, namely, drawing a line in the window (0,0)->(57,50):
HDC hdc = GetDC (hwnd);
MoveToEx (hdc, 0, 0, NULL);
LineTo (hdc, 57, 50);
ReleaseDC(hwnd,hdc);
In works as I would expect on Windows XP, but on Windows7 this makes a system to send WM_PAINT message to this window with update region: (0,0,58,51). Notice that rectangle is by one pixel wider than the square area affected by the line.
This WM_PAINT arriving because of this drawing is something that I don’t understand. The window is not touched/overlapped/resized or whatever. Apparently, this line is recognized by the system as invalidation of the rectangle.
And this only happens when in Windows 7 (as opposed to Windows XP).
Question
Is it something new about WDM or windows handling in W7? Any way to avoid this?
It maybe a bug in my program or the graphic toolkit I’m using (or both). But why it only manifests on Windows 7 then?
Thanks for any clue!
Denny