Is there a command that hides the dos window while the program executes??

Not long before did a similar thread arise. If you want to hide a window then you should use WIN32 rather than console as far as I know.

I saw the functionn GetConsoleWindow() in MSDN but I am unable to use it in both the compilers I have ( Dev C++ & Code::Blocks ) Please Help

I saw the functionn GetConsoleWindow() in MSDN but I am unable to use it in both the compilers I have ( Dev C++ & Code::Blocks ) Please Help

You need to ... #define _WIN32_WINNT 0x0500 // ... or higher

Now I get this,

||=== Hide, Debug ===|
F:\Programs\VC\Hide\main.cpp|2|warning: "_WIN32_WINNT" redefined|
D:\Dev-Cpp\bin\..\lib\gcc\mingw32\3.4.2\..\..\..\..\include\windef.h|20|warning: this is the location of the previous definition|
F:\Programs\VC\Hide\main.cpp||In function `int main()':|
F:\Programs\VC\Hide\main.cpp|7|error: `GetConsoleWindow' undeclared (first use this function)|
F:\Programs\VC\Hide\main.cpp|7|error: (Each undeclared identifier is reported only once for each function it appears in.)|
||=== Build finished: 2 errors, 2 warnings ===|

Add I do not know why I have to define _WIN32_WINNT, please do explain that too.

Great! No error No warning. The only problem was to search for the hidden window in task manager. Works great!

#define _WIN32_WINNT 0x0500
#include <windows.h>
#include <wincon.h>
int main()
{

    HWND hWnd = GetConsoleWindow();
    ShowWindow(hWnd, SW_HIDE);
    system ( "start firefox www.daniweb.com" ) ;
    Sleep ( 2000 ) ;
    ShowWindow(hWnd, 1 ) ;
    return 0 ;
}

I am working with Windows XP so should not I use 0x501?

alright I get most of that except the "sleep" syntax. Is that telling the computer to delay 2000 ms (2 seconds) before continuing the program?

I am using Dev C++ and the command isn't being recognized....

Should I be running Mcro. Visual Studio to run "Sleep" or is there a directive that I haven't included yet?

I use Dev, sleep should work as long as you have the #include <windows.h> and have a capital 'S' in Sleep(3000);

ehh, what the hell ? for some reason my post is before yours, even though i was answering yours :S

Happens to me sometimes.

This article has been dead for over six months. Start a new discussion instead.