Closing Window in C++

This is a discussion on Closing Window in C++ within the C++ Programming forums, part of the General Programming Boards category; running a program with Turbo C++ 4.5. On menu option to close program, it terminates and displays inactive. Anyone know ...

  1. #1
    Registered User
    Join Date
    Mar 2002
    Posts
    7

    Closing Window in C++

    running a program with Turbo C++ 4.5. On menu option to close program, it terminates and displays inactive. Anyone know how I could get C++ to close the Window on termination automatically instead of having to click the x box in the top right of the window. Thanks in advance for suggestions etc...

  2. #2
    Programming is fun, mkay?
    Join Date
    Oct 2001
    Posts
    490

    Post You can try...

    You can call this function where you want to exit:

    exit(1);
    Website(s): http://www16.brinkster.com/trifaze/

    E-mail: trifaze_mattu@lycos.com

    ---------------------------------
    C++ Environment: MSVC++ 6.0; Dev-C++ 4.0/4.1
    DirectX Version: 9.0b
    DX SDK: DirectX 8.1 SDK

  3. #3
    Registered User
    Join Date
    Mar 2002
    Posts
    7
    Thanks Syntax, will try it as I'm currently trying it with exit(-1);

  4. #4
    Registered User
    Join Date
    Oct 2001
    Posts
    2,934
    Here's one way.
    Code:
    #include <windows.h>
    .
    .
    //Put this in main() before return 0
    DestroyWindow(GetActiveWindow());
    Last edited by swoopy; 04-03-2002 at 01:01 PM.

  5. #5
    Registered User
    Join Date
    Mar 2002
    Posts
    7
    Thanks, Swoopy....will give it a try

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Just starting Windows Programming, School me!
    By Shamino in forum Windows Programming
    Replies: 17
    Last Post: 02-22-2008, 08:14 AM
  2. WM_CAPTION causing CreateWindowEx() to fail.
    By Necrofear in forum Windows Programming
    Replies: 8
    Last Post: 04-06-2007, 09:23 AM
  3. 6 measly errors
    By beene in forum Game Programming
    Replies: 11
    Last Post: 11-14-2006, 11:06 AM
  4. Linking OpenGL in Dev-C++
    By linkofazeroth in forum Game Programming
    Replies: 4
    Last Post: 09-13-2005, 11:17 AM
  5. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 01:34 PM

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