Click to See Complete Forum and Search --> : shell win32 programm - close it - howto


richard2
January 14th, 2003, 02:35 PM
hello,

how i can close a win shell (DOS/Box/Shell) programm automatical?

now it says "press a key to ......."
after the programm stops...

phreeezsix
January 14th, 2003, 06:08 PM
add the line return 0; to your main method. this only works for console

richard2
January 15th, 2003, 03:42 AM
i have in code

return 0;
}

but under win98 + xp there comes the sentence still again at my tests...

filthy_mcnasty
January 15th, 2003, 03:56 AM
well where are you running the exe from? a DOS prompt? windows explorer? or visual studio itself? VS wont drop out automatically but the other 2 will.

richard2
January 15th, 2003, 04:58 AM
in a DOS prompt

filthy_mcnasty
January 15th, 2003, 01:11 PM
you want it to close the DOS box? or it's simply not dropping out back to the dos prompt? either way it's weird because i dont think you can do the first and the second should just happen for you.

richard2
January 15th, 2003, 01:17 PM
yes, just want that the DOS box geht closed automatic.

normaly i can make like system, exit call, but the problem is the "press the key"..... comes after the programm

stober
January 15th, 2003, 02:11 PM
Just a wild-guess, but check you program to see if you have cin.ignore(), which will display that message.

... Also, are you starting your program via a batch file and have a pause in the batch file?

filthy_mcnasty
January 15th, 2003, 03:15 PM
if you type your executable at the DOS prompt your program exits back to it whether or not the "Press any key" message is shown.

i dont think you're actually doing that based on what you describe so i still dont understand how you are launching your program.

when your program runs do you type in the filename in DOS or do you double click something from windows?