Re: Terminating



Bob, thank you very much! Now I have:

m_pView->PostMessage(WM_CLOSE);

How does this relate to my main window in my SDI? Should I do something
different?
-----------
<Bob Moore> wrote in message
news:to2qt192q5dot6i8nvnjuhbajf921fg75m@xxxxxxxxxx
> On Sat, 28 Jan 2006 18:49:15 -0500, Steve Russell wrote:
>
>>What is the best way to terminate an MFC application, for instance, in the
>>event of certain kinds of errors?
>
> Post a WM_CLOSE to your main window. The default handler will shut
> down the app cleanly (if you haven't over-ridden it and done something
> funky).
>
> Using WM_QUIT will simply quit the main message loop, which means your
> windows won't get the opportunity for proper clean-up. Functional, but
> only one step up from terminating the process.
>
> --
> Bob Moore
> http://bobmoore.mvps.org/
> (this is a non-commercial site and does not accept advertising)
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Do not reply via email unless specifically requested to do so.
> Unsolicited email is NOT welcome and will go unanswered.
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


.



Relevant Pages

  • Re: Terminating
    ... posting it too deeply within a series of recurring calls and loops. ... How does this relate to my main window in my SDI? ... <Bob Moore> ...
    (microsoft.public.vc.mfc)
  • Re: Icon in System Tray (Taskbar) Disappears on Mouse-Over
    ... it failed to set up the icon, ... "Bob Moore" wrote: ... > and finds its window handle is not valid. ... > Unsolicited email is NOT welcome and will go unanswered. ...
    (microsoft.public.vc.mfc)
  • Re: Accept ONE character no need to hit enter in window?
    ... Objects are GET fields, check boxes, lists, popups, ... object or backward past the first object exits READ (if the CYCLE clause ... that was defined to terminate the READ also exits the READ. ... regardless of the window they are placed in. ...
    (microsoft.public.fox.programmer.exchange)
  • Re: Abnormally dropped sessions & running programs
    ... If I close the CA window either ... If so, an appropriate method to terminate the interactive process is via SIGNOFF or ENDJOB at the server, rather than trying to some end attempt from the client. ... If an application attempts to access the workstation device for a supported function which is not /recoverable/ when there is a device error, then the detection of the disconnected device will be manifest as an I/O error reported to the application which attempted to access that device. ... There may not be any reasonable or explicitly supported method to communicate directly with the device, such that the most appropriate resolution would be by running the application in a batch job instead of in an interactive job, such that no dependency exists between the application and a device. ...
    (comp.sys.ibm.as400.misc)
  • Re: Killing an application
    ... Registered Window Message to ask a process to terminate itself. ... If it is a console app, you probably should not be using ShellExecute; if you know it is a ... ..exe file, ShellExecute is probably a poor choice, you should consider CreateProcess, ...
    (microsoft.public.vc.mfc)