PDA

View Full Version : Overriding default behavior in DOS console w/MFC



Waldo2k2
07-02-2002, 07:36 AM
I've created a DOS console with support for MFC, whenever the program ends, the user is prompted to press any key to close the window, i don't want this to happen, but it seems to be somewhere in MFC. I simply use:


cout<<"Press Any Key To Quit"<<endl;
getch();
return nRetCode;

but after they press any key, the console (not the part of code i've written) asks them to press any key again to quit, very annoying for them, and i'd much rather have my message appear than the one that MFC puts up, especially when i exit on an error. If anyone knows how to change the code for that, it would be much appreciated, if it's too tough to change it, and anyone knows how to access that string i could just change it and wouldn't have to use my code on exit....thanks.

sean
07-02-2002, 12:14 PM
My guess is that the message is generated when nRetCode is asked for, so if you can find the final function called, you can just overide that to do exactly what it it does, but return a custom message.

Waldo2k2
07-10-2002, 08:42 AM
turns out is' and MS-DOS standard, can't change it. I tried hacking it like changing the text color to black but that doesn't help because it still waits for you to press any key, so oh well, i'm just goint to have to deal with it.