• Advertisement

Archived

This topic is now archived and is closed to further replies.

Closing automatically console window

This topic is 5640 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I have a console application under windows which always needs a key press when terminated, which is quite annoying. How can I avoid this? Thanks

Share this post


Link to post
Share on other sites
Advertisement
Wasn''t there something with GetProcess(...) and KillProcess(...)? Hummm, just look in the MSDN for this...

Share this post


Link to post
Share on other sites
One solution is TerminateProcess(). However, you should only use it as a last resort.

Kuphryn

Share this post


Link to post
Share on other sites
Is it a program you wrote? I''ve never had that happen before. You might want to check the Properties for the program. There might be a "Close window on exit" option.

Share this post


Link to post
Share on other sites
Yes I wrote a little Win32 console application and every time I leave the main function with "return 0", the console prints "Press any key to continue" and waits for a key before leaving...

Share this post


Link to post
Share on other sites
I would think that only happens when it''s started from the IDE, right?



When I look upon seamen, men of physical science, and philosophers, man is the wisest of all beings. When I look upon priests, prophets, and interpreters of dreams, nothing is so contemptible as man.


  Diogenes

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Take out the system("PAUSE";

Try that...

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
where i find "system("PAUSE";"

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
MSVC console apps do this. There is a way around it but I can''t remember it at the moment. Check google. System("PAUSE" is commonly used with other compilers that don''t make you press a key to exit.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster

  vc++ doesn''t use system("PAUSE");  

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
If you compile the debug version of your program then it adds the system("PAUSE" for you, if you compile for release, it doens''t.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Mine even stops in release mode.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
it''s not possible in vc++6 sp5

Share this post


Link to post
Share on other sites

  • Advertisement