Re: WM_QUIT and WM_CLOSE

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Scott McPhillips [MVP] (scottmcp_at_mvps.org.nothere)
Date: 05/15/04


Date: Sat, 15 May 2004 12:06:42 -0500

Yasoo wrote:
> If WM_CLOSE is sent to the main window of an application, is that the same as WM_QUIT?
>
> Will a WM_QUIT result in sending a WM_CLOSE to the main window?
>
> Thank you.

No, they are very different. WM_QUIT terminates the message loop.
Obviously, it wouldn't make much sense to send a message after
terminating the message dispatcher. Use WM_CLOSE to close windows or
the application. WM_QUIT is taken care of by the framework.

-- 
Scott McPhillips [VC++ MVP]


Relevant Pages

  • Re: PostQuitMessage
    ... > PostQuitMessage only terminates the message loop, ... > destroy any windows. ... But I would've thought that once the message loop receives a WM_QUIT, ... thus also killing all relevant windows. ...
    (microsoft.public.vc.mfc)
  • Re: PostQuitMessage
    ... > PostQuitMessage only terminates the message loop, ... > destroy any windows. ... But I would've thought that once the message loop receives a WM_QUIT, ... thus also killing all relevant windows. ...
    (microsoft.public.vc.mfc)
  • Re: CWinThread determining if a thread is still alive
    ... doing a PostMessage to some designated window, right before it terminates. ... happens right before the thread function, or the function it first called, terminates). ... See my essay on worker threads on my MVP Tips site. ... >I create a CWinThread object and have a pointer to it. ...
    (microsoft.public.vc.mfc)