I want to know how to hide a console window when it starts.
It\'s for a keylogger program, but it\'s not my intention to hack someone. It\'s for a littl
It is simple. FreeConsole() api will do that magic for you
BOOL WINAPI FreeConsole(VOID);
To literally hide/show the console window on demand, you could use the following functions: It's possible to hide/show the console by using ShowWindow. GetConsoleWindow retrieves the window handle used by the console. IsWindowVisible can be used to checked if a window (in that case the console) is visible or not.
#include <Windows.h>
void HideConsole()
{
::ShowWindow(::GetConsoleWindow(), SW_HIDE);
}
void ShowConsole()
{
::ShowWindow(::GetConsoleWindow(), SW_SHOW);
}
bool IsConsoleVisible()
{
return ::IsWindowVisible(::GetConsoleWindow()) != FALSE;
}
Just do that on startup
myConsole = GetConsoleWindow();
ShowWindow(myConsole,0);