Thread: DOS in windows?

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    43

    Question DOS in windows?

    Hello there, I make little program's that run in DOS, when you run the *.exe file it opens a DOS window is there some code that I could put in my program's so that when it finishes the window will auto close? Any and all help I thank you for.
    ()(ôô)()© MonKey ware
    Kyle J. R.

  2. #2
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    do a search at msdn for FreeConsole().
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  3. #3
    Registered User
    Join Date
    Sep 2001
    Posts
    752
    I am inclined to say yes, I'm pretty sure that this is an attribute that you can specify when creating a window class, but that means using windows programming to make a DOS-box application. There isn't any -easy- way to do it in the code itself.

    Of course, if you call your program through a shortcut, or gdi file, then you could specify in there that you want the program to close on exit.
    Callou collei we'll code the way
    Of prime numbers and pings!

  4. #4
    Unregistered
    Guest
    I think what you're really looking for is the exit() function.

    hope this helps.

  5. #5
    Registered User
    Join Date
    Jan 2002
    Posts
    41
    yep sound like exit() is deffinitely what you're looking for
    although be aware that closing a program automatically may not allow the user to see the end results you will have to use a getch(); or run the prog from the prompt

    hope this is what your after.

  6. #6
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    exit will not close the console. just drop out of it to a prompt!

    to close the console write a small windows app that uses AllocConsole() to get a DOS console. Do what you want in the console. Then call FreeConsole() to clean up and get rid of the console. Do a search at msdn for console functions for more info.
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Learning Dos and learning Windows
    By blankstare77 in forum C++ Programming
    Replies: 8
    Last Post: 07-31-2005, 03:48 PM
  2. getting to true DOS with windows NT
    By major_small in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 11-05-2003, 05:23 PM
  3. real mode dos & win dos
    By scott27349 in forum A Brief History of Cprogramming.com
    Replies: 26
    Last Post: 08-19-2002, 06:15 AM
  4. 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
  5. Shut off DOS screen automatically to Windows
    By Unregistered in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 11-08-2001, 07:14 PM