Skip to content

Instantly share code, notes, and snippets.

@L4ZZA
Last active December 10, 2019 17:44
Show Gist options
  • Save L4ZZA/2c8aa496fd7495c16def5cef060f6c2b to your computer and use it in GitHub Desktop.
Save L4ZZA/2c8aa496fd7495c16def5cef060f6c2b to your computer and use it in GitHub Desktop.
Hide/Show console based on configuration for debug purposes.
//==========================================//
// Author: Pietro Lazzarotto //
// Credits 2019 //
//==========================================//
int main(int argc, char** argv)
{
#ifdef _DEBUG
// get the console handle
auto hwnd = GetConsoleWindow();
// change siize and position of the console to be at the bottom 1/4th of the screen (roughtly).
SetWindowPos(hwnd, HWND_TOP, 0, 1080 * 0.72, 1920, 1080 * 0.25, SWP_NOZORDER);
// Show console
ShowWindow(hwnd, SW_SHOW);
#else
// hide console
ShowWindow(GetConsoleWindow(), SW_HIDE);
#endif
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment