Skip to content

Commit

Permalink
Maximize terminal with conhost (win10)
Browse files Browse the repository at this point in the history
  • Loading branch information
eric15342335 committed Jun 17, 2024
1 parent c661485 commit 794cc94
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,22 @@ void enableWindowsVTProcessing(void) {
// Enable virtual terminal processing
consoleMode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING;
SetConsoleMode(GetStdHandle(STD_OUTPUT_HANDLE), consoleMode);
std::cout << "Experimental Windows VT processing enabled." << std::endl;
// Enable Data Execution Prevention (DEP) for the process
SetProcessDEPPolicy(PROCESS_DEP_ENABLE);
std::cout << "Experimental Windows VT processing enabled.\n";
}
void maximizeTerminalScreen_win10(void) {
/** @note Windows 11 needs to set the default terminal application to Conhost
* to maximize the terminal screen.
* Terminal -> Settings -> Default Terminal Application -> Conhost
*/
ShowWindow(GetConsoleWindow(), SW_MAXIMIZE);
std::cout << "Terminal screen maximized.\n";
}
void windowsRoutines(void) {
enableWindowsVTProcessing();
maximizeTerminalScreen_win10();
}
#else
#define enableWindowsVTProcessing() // Do nothing
#define windowsRoutines() // Do nothing
#endif

/**
Expand Down Expand Up @@ -320,7 +330,7 @@ void initializePlayerSaves(
}

int main(void) {
enableWindowsVTProcessing();
windowsRoutines();
std::cout << "The game was compiled on " << __DATE__ << " at " << __TIME__
<< std::endl;

Expand Down

0 comments on commit 794cc94

Please sign in to comment.