On 12/8/2014 8:24 AM, "chong kyong kim" wrote:
I have got one more question. The program consists of two windows, main window
in the background and sub window in the foreground initially. When I tap on
the main window in the background, it brings it to the foreground. This gets
EN_UPDATE, EN_CHANGE, and EN_SETFOCUS sent away in [Q 1]. But I don't see
WM_PAINT sent away three times in [Q2] but just once
InvalidateRect doesn't immediately send WM_PAINT. It marks a window (or a portion of it) as "invalid". This means that, next time the message loop calls GetMessage and there are no messages to be processed, a WM_PAINT message is generated for that window.
Calling InvalidateRect on a window that's already marked invalid doesn't do anything. You call it three times in a row - the first one marks the window invalid; the other two also, technically, do so - but it's been invalid already anyway. Eventually, all calls to window procedures return back to the message pump, the application calls GetMessage, which notices that the window is invalid and generates WM_PAINT.
(the subwindow appears
to have received the message three times though).
How do you determine how many times the message is sent, and how many times it is received? How do you come up with different counts for the two?
Igor Tandetnik