🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.windows.ms.programmer
Article #2860

Re: PeekMessage and WM_PAINT messages

#2860
From: Kent Forschmiedt
Date: Sun, 26 May 1991 21:14
26 lines
1941 bytes
In article <1991May26.084935.14400@usenet.ins.cwru.edu> trier@po.CWRU.Edu writes:
>I'm a little confused by the "Comments" section of the PeekMessage entry
>in the SDK Reference Volume 1, page 4-330.  It states, "PeekMessage does
>not remove WM_PAINT messages from the queue.  The messages remain in the
>queue until processed."  Does "processed" refer to the BeginPaint function,
>or is there something else I need to do when using PeekMessage?

From ValidateRect in the SDK Reference:  "Windows continues to generate
WM_PAINT messages until the current update region is validated."

Neither PeekMessage nor GetMessage "removes" WM_PAINT messages from the
queue.  WM_PAINT is generated when a window has a non-NULL update region
and there are no messages on the window's queue.  (Is that true, or can it
be generated when certain messages are pending?)  Anyway, the behaviour is
the same whether you got the message with Peek or Get, or even if you never
retrieved the message at all.

The update region may be retrieved with GetUpdateRect() or GetUpdateRgn().
BeginPaint(hwnd, &ps) does GetUpdateRect(hwnd, lpps->rcPaint, bErase) for
you.  (If somebody knows where the bErase flag (from the Invalidate{Rect,Rgn}
call) is stashed, I'd like to know.)

ValidateRect or ValidateRgn must be used to validate the update region.
EndPaint(hwnd, &ps) does a ValidateRect(hwnd, lpps->rcPaint).  
-- 
Kent Forschmiedt ... kentfo@polari ... uw-beaver!sumax!polari!kentfo
Technical Details
Message-ID: <4243@polari.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!dali.cs.montana.edu!milton!sumax!polari!kentfo
References: <1991May26.084935.14400@usenet.ins.cwru.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!dali.cs.montana.edu!milton!sumax!polari!kentfo
From: kentfo@polari.UUCP (Kent Forschmiedt)
Newsgroups: comp.windows.ms.programmer
Subject: Re: PeekMessage and WM_PAINT messages
Keywords: PeekMessage WM_PAINT
Message-ID: <4243@polari.UUCP>
Date: 26 May 91 21:14:53 GMT
References: <1991May26.084935.14400@usenet.ins.cwru.edu>
Organization: Seattle Online Public Unix (206) 328-4944
Lines: 26