Link to home
Start Free TrialLog in
Avatar of samroyc
samroyc

asked on

AfxMessageBox to quit the Application

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);
if(nres==IDABORT)
{
     quit!
}
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
Avatar of Jaime Olivares
Jaime Olivares
Flag of Peru image

Appears to be ok, but I think your problem is in another portion of your code, maybe you can post a little more.
Avatar of Axter
Hi samroyc,
>>      quit!
What is quit! ???

David Maisonave :-)
Cheers!
I sincerly hope the asker has not written quit! directly in the source code   ;)
ASKER CERTIFIED SOLUTION
Avatar of wayside
wayside

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of samroyc
samroyc

ASKER

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
Please post some more code around the problem
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.
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?