Solved

Application error when closing down...

Posted on 2002-03-19
5
173 Views
Last Modified: 2013-11-20
When I try to close my app by running

void CMainFrame::QuitApp()
{
     SendMessage (WM_COMMAND, ID_APP_EXIT);
}

I get an APP Error type the memory could not be read at location 0x0000a0.

Can anybody help me get rid of this error. Should I send another message or what???

Thanks for your help.

TOM
0
Comment
Question by:tomschoem
5 Comments
 
LVL 30

Expert Comment

by:SteveGTR
ID: 6880074
Try SendMessage(WM_CLOSE)

Good Luck,
Steve
0
 
LVL 32

Expert Comment

by:jhance
ID: 6880180
One sure-fire way of causing this error is to send a message to a window that is already gone.  Are you SURE that this window is still open when this function gets called?
0
 
LVL 1

Expert Comment

by:kirthir
ID: 6880428
The same SendMessage command worked fine for me.
By the way what is "QuitApp()", Is it a user function or windows handler?

Also, u can change the code as follows to get the required effect.
void CMainFrame::QuitApp()
 {
PostQuitMessage(0)
 }
0
 
LVL 1

Accepted Solution

by:
kirthir earned 200 total points
ID: 6880435
This is really a clean way of achieving it

void CMainFrame::QuitApp()
{
    PostQuitMessage(0)
}
0
 

Author Comment

by:tomschoem
ID: 6882116
Cheers that will do!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Question regarding Copy/Paste 16 91
Pressing cancel button with C# UI Automation 3 51
Line meaning 9 82
Is there a simple front-end menu system. 9 71
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

896 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now