#include <iostream>using namespacestd;//I ' m using Vista ATM (It's evil), but GCC comes assuming the worst.//If you haven ' t patched your compiler to agree with the actual version//of the Windows OS, then you'll need to make sure your do it like this.//#if_win32_winnt < 0x0500#undef_win32_winnt#define_win32_winnt 0x0500#endif#include<windows.h>//Here's some fun timer stuff for the user.//(Notice how he won ' t see it//console is hidden, but it'll still work.)voidtimeout () { for(intCntr =3; Cntr >0; cntr--) {cout<<"\ r"<< cntr <<Flush; Sleep ( + ); } cout<<"\ r"<<Flush; }//demonstrate some fun stuff.//Notice How hiding the console window causes it-disappear from//The Windows task bar. If you have want to make it minimize//sw_minimize instead of Sw_hide.//intMain () {cout<<"Preparing to hide the console window\n"; Timeout (); ShowWindow (Getconsolewindow (), sw_hide); cout<<"Preparing to show the console window\n"; Timeout (); ShowWindow (Getconsolewindow (), sw_restore); cout<<"All done!\n"; return 0; }
Copy from:http://www.cplusplus.com/forum/beginner/12001/
Hide Terminal program window