Re: Terminating
- From: "Steve Russell" <srussell@xxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 10 Mar 2006 06:07:46 -0500
Coming back to this situation after some weeks have passed,
AfxGetMainWnd()->PostMessage(WM_CLOSE) is working cleanly now. I had been
posting it too deeply within a series of recurring calls and loops.
Once again, thanks for the essential aid.
--------------
"Joseph M. Newcomer" <newcomer@xxxxxxxxxxxx> wrote in message
news:nh7st1l5sjonvjkt25jk0u7mrvjfqjjf28@xxxxxxxxxx
Could it be that your program has a bug? Note that if posting a WM_CLOSE
message fails,
then any other attempt to close your app should fail. This would
represent an erroneous
program. Are you using any threads? If so, are you making sure they shut
down correctly?
joe
On Mon, 30 Jan 2006 07:21:57 -0500, "Steve Russell"
<srussell@xxxxxxxxxxxxxxxxxxxxxx>
wrote:
For instance, my View pointer is no longer valid. Nor are perhaps any ofJoseph M. Newcomer [MVP]
my
custom classes. The program attempts to keep running and quickly gets
into
trouble on that basis. I will take a closer look. It could be that I
need
to break out of any calling loops at the point of the error.
------------
"M" <a@xxxxx> wrote in message
news:eOcTDAVJGHA.2696@xxxxxxxxxxxxxxxxxxxxxxx
What sort of variables?
"Steve Russell" <srussell@xxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:e6skTUUJGHA.1032@xxxxxxxxxxxxxxxxxxxxxxx
Thanks, M. Actually, these WM_CLOSE messages are crashing my program,
hanging up on variable that no longer have legit values. I am not sure
what to do.
------------
"M" <a@xxxxx> wrote in message
news:%23xq1kSTJGHA.3856@xxxxxxxxxxxxxxxxxxxxxxx
If I may be so bold...
: )
Try ::PostMessage(AfxGetApp()->m_pMainWnd->GetSafeHwnd(), WM_CLOSE,
0,
0);
"Steve Russell" <srussell@xxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:O9aFGYSJGHA.2668@xxxxxxxxxxxxxxxxxxxxxxx
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.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.
- Prev by Date: Re: Problems linking CxImage
- Next by Date: Re: Difference between CAsyncSocket and WinSock API
- Previous by thread: MySQL OleDB ?
- Next by thread: Re: 256 color BITMAP to ICON
- Index(es):
Relevant Pages
|