Overriding default behavior in DOS console w/MFC

This is a discussion on Overriding default behavior in DOS console w/MFC within the A Brief History of Cprogramming.com forums, part of the Community Boards category; I've created a DOS console with support for MFC, whenever the program ends, the user is prompted to press any ...

  1. #1
    PC Fixer-Upper Waldo2k2's Avatar
    Join Date
    May 2002
    Posts
    2,001

    Overriding default behavior in DOS console w/MFC

    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:
    Code:
    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.
    PHP and XML
    Let's talk about SAX

  2. #2
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    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.

  3. #3
    PC Fixer-Upper Waldo2k2's Avatar
    Join Date
    May 2002
    Posts
    2,001
    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.
    PHP and XML
    Let's talk about SAX

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. windows dos console
    By dune911 in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 01-16-2002, 11:30 PM
  2. DOS program versus DOS console program
    By scromer in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 01-10-2002, 01:42 PM
  3. Using X,Y Coords in DOS Console
    By BigSter in forum C++ Programming
    Replies: 5
    Last Post: 12-11-2001, 08:39 AM
  4. difference between dos and console?
    By Qwertop in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 11-14-2001, 08:58 PM
  5. My next 'dos console' game...
    By Leeman_s in forum C++ Programming
    Replies: 5
    Last Post: 11-09-2001, 06:08 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21