![]() |
VOOZH | about |
The console is an OS window through which users interact with the operating system either by entering text input through the computer keyboard or by reading text output from the computer terminal.
The term console is derived from the French word 'consolide', which is derived from the Latin word 'consolidare', meaning 'to strengthen'.
ShowWindow shows or hides a window. The function can minimize, maximize, or restore a given window. If the function returns 0, it means the window has been hidden before the call and if it returns a non-zero value it had been visible.
Syntax:
BOOL ShowWindow( [in] HWND hWnd, [in] int nCmdShow );
Value: SW_HIDE 0
Meaning: Hides the window and activates another window.
Output:
Example:
Explanation: The execution of the program can be understood by understanding the key functions of the program.
Note: SW_MINIMIZE instead of SW_HIDE to have the console hidden but still visible in the taskbar.
For Windows systems:
Note: This will return a windows handle (HWND) to ShowWindow() which will hide the console window.
FreeConsole() function can be used for detaching a process from its console. If two or more processes share the same console, the console is not destroyed, but the process that is called FreeConsole cannot refer to it. A console is closed when the last process attached to it terminates or calls FreeConsole() function.
Example:
Apart from the above methods, we can write these lines in our program to hide the console window on startup.
Example: