WM_QUIT 
Author Message
 WM_QUIT

Hi,
        I've written a program that needs to execute a bit of code if it is
running when a user quits windows. How do I do this - I know it has
something to do with WM_QUIT.

Many thanks,

Richard.



Fri, 11 Jul 2003 22:13:48 GMT  
 WM_QUIT
PS: The program is an MFC dialog app.

Thanks,


Quote:
> Hi,
>         I've written a program that needs to execute a bit of code if it
is
> running when a user quits windows. How do I do this - I know it has
> something to do with WM_QUIT.

> Many thanks,

> Richard.



Fri, 11 Jul 2003 22:19:57 GMT  
 WM_QUIT
Perhaps you are looking for the WM_QUERYENDSESSION and WM_ENDSESSION
messages.


Quote:
> Hi,
>         I've written a program that needs to execute a bit of code if it
is
> running when a user quits windows. How do I do this - I know it has
> something to do with WM_QUIT.

> Many thanks,

> Richard.



Fri, 11 Jul 2003 23:54:16 GMT  
 WM_QUIT


Quote:
> Hi,
>         I've written a program that needs to execute a bit of code if it
is
> running when a user quits windows. How do I do this - I know it has
> something to do with WM_QUIT.

> Many thanks,

> Richard.

Hello Richard
It's WM_ENDSESSION you want. Look at CWnd::OnEndSession
Jon


Sat, 12 Jul 2003 00:11:16 GMT  
 WM_QUIT

Quote:
>         I've written a program that needs to execute a bit of code if it
is
> running when a user quits windows. How do I do this - I know it has
> something to do with WM_QUIT.

Not exactly. The WM_QUIT message is sent to an application when it is about
to end. It may be about to end because the user is about to exit Windows or
it may be about to end because the user chose Close from the system menu.

Check the docs for WM_QUERYENDSESSION and WM_ENDSESSION. They are the
messages most connected to Windows' exit.

Regards,
Will



Sat, 12 Jul 2003 00:27:19 GMT  
 WM_QUIT
It is also possible to override the base OnDestroy() function like so:

void CMyAppView::OnDestroy()
     {
     // Overridden to close the app
    if (foo == bar)
        {
        DoThis;
        }

     CView::OnDestroy();
     PostQuitMessage(0);
     }

Hope it helps -
Ron G{*filter*}



Quote:


> >         I've written a program that needs to execute a bit of code if it
> is
> > running when a user quits windows. How do I do this - I know it has
> > something to do with WM_QUIT.

> Not exactly. The WM_QUIT message is sent to an application when it is
about
> to end. It may be about to end because the user is about to exit Windows
or
> it may be about to end because the user chose Close from the system menu.

> Check the docs for WM_QUERYENDSESSION and WM_ENDSESSION. They are the
> messages most connected to Windows' exit.

> Regards,
> Will



Sun, 13 Jul 2003 07:58:32 GMT  
 WM_QUIT

Quote:
> It is also possible to override the base OnDestroy() function like so:

> void CMyAppView::OnDestroy()
>      {
>      // Overridden to close the app
>     if (foo == bar)
>         {
>         DoThis;
>         }

>      CView::OnDestroy();
>      PostQuitMessage(0);
>      }

> Hope it helps -
> Ron G{*filter*}

I don't think it does. The OP asked how to execute code when the user quits
Windows, not how to quit when the user closes a window.

Regards,
Will



Sun, 13 Jul 2003 14:12:17 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. can't accept WM_QUIT message

2. user interface thread - DoModal and PostThreadMessage(WM_QUIT, 0, 0)

3. how to handle WM_QUIT message in MFC?

4. PumpMessage doesn't receive WM_QUIT

5. Help with WM_QUIT

6. WM_QUIT

7. threads and WM_QUIT

8. Mainframe Close & WM_QUIT

9. MFC EXE with ATL object never getting WM_QUIT on shutdown

10. Is PostMessage(WM_QUIT) Safe?

11. : WM_QUIT

12. MFC handling of WM_QUIT

 

 
Powered by phpBB® Forum Software