I have read that I should never send WM_PAINT manually and should call InvalidateRect instead but didn\'t found anything about why not, however. So
Because WM_PAINT is not a real message.
Think of it like each window has a structure storing an "invalid region", that is, "this part of the window on the screen is not up to date anymore and need to be repainted".
That invalid region is modified by the window manager itself (window is resized, uncovered, etc ), or by calls to InvalidateRect, ValidateRect, EndPaint and such.
Now, here is a crude mock-up of how GetMessage handles this :
... GetMessage(MSG* msg, ...)
{
while(true) {
if(ThereIsAnyMessageInTheMessageQueue()) {
*msg = GetFirstMessageOfTheMessageQueue();
return ...;
} else if(TheInvalidRegionIsNotEmpty()) {
*msg = CreateWMPaintMessage();
return ...;
} else {
WaitUntilSomethingHappend();
}
}
}
tl;dr: WM_PAINT is meant to be received, not sent.