Console

This is a discussion on Console within the Windows Programming forums, part of the Platform Specific Boards category; If I open up a Window console is there a way to check to see if the user pressed the ...

  1. #1
    Registered User sean345's Avatar
    Join Date
    Mar 2002
    Posts
    346

    Console

    If I open up a Window console is there a way to check to see if the user pressed the "x" button in the top right corner. I have some routines I need to run before the program exits to free up some memory.

    - Sean
    If cities were built like software is built, the first woodpecker to come along would level civilization.
    Black Frog Studios

  2. #2
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,136
    Check the WM_CLOSE or WM_DESTROY messages.

  3. #3
    Registered User
    Join Date
    Dec 2001
    Posts
    421
    didn't he say "console"??

    there aren't any windows messages sent to the program if you dont have a message handler, and you dont have one in console mode!
    Quidquid latine dictum sit, altum sonatur.
    Whatever is said in Latin sounds profound.

  4. #4
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,136
    If you open up a console window in a Win32 App, there are no messages sent? I always assumed there was. Never found the need to try it. Guess I shouldn't assume (you all know how the saying goes).

  5. #5
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,789
    Your right GG

    The console is a window like any other....it has messages and the like, but if at any point I wondered about the messages my console was processing, its a good indication that I shouldnt be in console mode

    Time to build a proper Win32 App

  6. #6
    Registered User
    Join Date
    Dec 2001
    Posts
    421
    The console is a window like any other....it has messages and the like

    yes it is, but when you have a standard console application, the console 'window' looks after it's own messages, they aren't passed to your console application's code.

    If that's precisely what you said, then ignore this post

    U.
    Quidquid latine dictum sit, altum sonatur.
    Whatever is said in Latin sounds profound.

  7. #7
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,789
    Originally posted by Uraldor
    The console is a window like any other....it has messages and the like

    yes it is, but when you have a standard console application, the console 'window' looks after it's own messages, they aren't passed to your console application's code.

    If that's precisely what you said, then ignore this post

    U.
    Yeah that's what I meant .....you can try to manipulate the console window yourself with subclassing or SendMessage(), but if it ever crosses you mind, you would be better off with a proper window.

    It still amazes me though how many people want to build functionality into their consoles instead of biting the bullet and learning how to create proper Win32 Apps.......ah well!!......you cant convince them all

  8. #8
    Registered User
    Join Date
    Dec 2001
    Posts
    421
    yeah.. aint that the truth i have the same problem with a few people that i'm teaching

    ah well, i'll let them sell themselves short

    cheers
    U.
    Quidquid latine dictum sit, altum sonatur.
    Whatever is said in Latin sounds profound.

  9. #9
    Registered User sean345's Avatar
    Join Date
    Mar 2002
    Posts
    346
    Actually I did not avoid making a proper win32 App I can already make one. I am making an interpreter and the program is executed in console mode.

    Thanks for your help.

    - Sean
    If cities were built like software is built, the first woodpecker to come along would level civilization.
    Black Frog Studios

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Console, Terminal and Terminal Emulator
    By lehe in forum C Programming
    Replies: 4
    Last Post: 02-15-2009, 08:59 PM
  2. Full Screen Console
    By St0rmTroop3er in forum C++ Programming
    Replies: 1
    Last Post: 09-26-2005, 09:59 PM
  3. Problems with a simple console game
    By DZeek in forum C++ Programming
    Replies: 9
    Last Post: 03-06-2005, 01:02 PM
  4. Console Functions Help
    By Artist_of_dream in forum C++ Programming
    Replies: 9
    Last Post: 12-04-2004, 02:44 AM
  5. Just one Question?
    By Irish-Slasher in forum C++ Programming
    Replies: 6
    Last Post: 02-12-2002, 09:19 AM

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