Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


AfxMessageBox to quit the Application

Posted on 2005-04-23
Medium Priority
Last Modified: 2013-11-20
I am tryig to use the int returned from AfxMessageBox .If the user chooses Abort,I'd like to exit from the application

int nres=AfxMessageBox("wrong ",MB_ABORTRETRYIGNORE|MB_ICONSTOP);
I get a compiler error saying "nres undeclared identifier",butt I have nres as an int just the prev line.Is there something
wrong with my declaration?
Thanks for any help
Question by:samroyc
  • 3
  • 2
  • 2
  • +1
LVL 55

Expert Comment

by:Jaime Olivares
ID: 13851730
Appears to be ok, but I think your problem is in another portion of your code, maybe you can post a little more.
LVL 30

Expert Comment

ID: 13851848
Hi samroyc,
>>      quit!
What is quit! ???

David Maisonave :-)
LVL 55

Expert Comment

by:Jaime Olivares
ID: 13851856
I sincerly hope the asker has not written quit! directly in the source code   ;)
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

LVL 14

Accepted Solution

wayside earned 750 total points
ID: 13857667
For the 'quit' part you have options:

sledgehammer approach:


A better Windows way:



Author Comment

ID: 13863205
No,the user has not written "quit",into source code!!
I guess I should have made it clearer,but the bottleneck is before the code gets to the
different commands I tried for" quit",including exit(0).My code doesnot enter the if loop as it cannot identify the integer
nres which I defined just the prev line.hence I substituted "quit" for anything that I wrote inside that loop.
My question is why does my code have a problem with the integer nres.I have checked for typos and case etc..
Thank you for the interest and help
LVL 55

Expert Comment

by:Jaime Olivares
ID: 13863218
Please post some more code around the problem
LVL 30

Expert Comment

ID: 13863306
What type of file do you have this code in?
Is it a *.cpp file or a *.c file?
Makre sure it's a *.cpp file, and not a *.c file.
LVL 14

Expert Comment

ID: 13863342
This is quite strange...

Can you cut and paste 8 or 10 lines around this error, and paste in the *exact* error message that you are getting?

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
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.
Kernel Data Recovery is a renowned Data Recovery solution provider which offers wide range of softwares for both enterprise and home users with its cost-effective solutions. Let's have a quick overview of the journey and data recovery tools range he…
Suggested Courses
Course of the Month12 days, 9 hours left to enroll

579 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