Ending a C++ program

This is a discussion on Ending a C++ program within the C++ Programming forums, part of the General Programming Boards category; Hi, I am a newbie who is trying to find a command/syntax to end a program from the menu of ...

  1. #1
    Registered User
    Join Date
    May 2005
    Posts
    1

    Ending a C++ program

    Hi, I am a newbie who is trying to find a command/syntax to end a program from the menu of that program.

    Does such a command exist? In basic it is just a simple end but I have been unable to find anything.

    Tony Evans
    Australia

  2. #2
    Registered User
    Join Date
    May 2005
    Posts
    50
    exit(0), google search that, it might help.

  3. #3
    Registered Luser
    Join Date
    Apr 2003
    Posts
    17
    Quote Originally Posted by tonevans
    Hi, I am a newbie who is trying to find a command/syntax to end a program from the menu of that program.
    "menu of that program"? Are you working with a GUI application? Then you may need to clean up othe resources than just calling exit().

  4. #4
    Registered User
    Join Date
    May 2005
    Posts
    28
    Well if you're workign with the GUI... then you created a menu, you should know how to check if a menu item is cliked with WM_COMMAND then checking the low word of wParam to make sure it was the exit item of your menu.

    Then do:

    Code:
    PostMessage(hWnd, WM_CLOSE, 0, 0);
    With the proper handle of course. THen in WM_CLOSE, EndDialog or DestroyWindow or whatever you have to do to end it. Then make sure you call PostQuitMessage also... to get out of the message loop.


Popular pages Recent additions subscribe to a feed

Similar Threads

  1. BOOKKEEPING PROGRAM, need help!
    By yabud in forum C Programming
    Replies: 3
    Last Post: 11-16-2006, 10:17 PM
  2. Can someome help me with a program please?
    By WinterInChicago in forum C++ Programming
    Replies: 3
    Last Post: 09-21-2006, 10:58 PM
  3. I need some help with my program please.
    By agentxx04 in forum C Programming
    Replies: 9
    Last Post: 09-26-2004, 07:51 AM
  4. help with ending program
    By Derek in forum C Programming
    Replies: 13
    Last Post: 06-25-2003, 12:10 PM
  5. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM

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