close the console once GUI is loaded?
Hello,
My application needs to be started through console.. Or in other words, on double clicking, myprog.exe, a small terminal opens, which leads a GUI window to be displayed.. What i want is to close the console once my GUI is loaded. How can i do this.??
Thanks
Re: close the console once GUI is loaded?
Create a console with:
Code:
// Allocate a new console.
AllocConsole();
// Redirect stdout to the console.
_tfreopen( _T("CONOUT$"), ("a+t"), stdout);
When you're done with it...
Consult msdn for options with regard to _tfreopen params.
__________________________________________________________
Arjay
See my latest series on using WCF to communicate between a Windows Service and WPF task bar application.
Tray Notify - Part I Tray Notify - Part II
Need a little help with Win32 thread synchronization? Check out the following CG articles and posts:
Sharing a thread safe std::queue between threads w/progress bar updating
Simple Thread: Part I Simple Thread: Part II
Win32 Thread Synchronization, Part I: Overview Win32 Thread Synchronization, Part 2: Helper Classes
www.iridyn.com
Re: close the console once GUI is loaded?
Hi..
By doing this, will i be able to view only GUI app..? or along with that separate console will be coming..??
I dont want console at all to be displayed.. its ok if it is running in background or invisible..
Thanks
Re: close the console once GUI is loaded?
Code:
int main()
{
::ShowWindow(::GetConsoleWindow(), SW_HIDE);
// ...
}
Re: close the console once GUI is loaded?
Quote:
Originally Posted by
rakeshthp
Hi..
By doing this, will i be able to view only GUI app..? or along with that separate console will be coming..??
I dont want console at all to be displayed.. its ok if it is running in background or invisible..
Thanks
Why not try the code I posted and find out? Then try Ovidio's code.