From 4587d15d2cf030683a294a7154fd4e760cd6112a Mon Sep 17 00:00:00 2001 From: Tomuxs Date: Tue, 3 Jun 2025 14:24:22 +0200 Subject: [PATCH] Swapped shell call, to cmd mode change. --- src/main.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main.c b/src/main.c index 5e9def9..c56d4da 100644 --- a/src/main.c +++ b/src/main.c @@ -1,5 +1,6 @@ #include #include +#include #include #include @@ -39,8 +40,14 @@ static void PrintLastError() { int main() { + // Get console handle + HANDLE cmd = GetStdHandle(STD_OUTPUT_HANDLE); + // Enable console colors - system("color"); + DWORD cmdMode; + GetConsoleMode(cmd, &cmdMode); + cmdMode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING; + SetConsoleMode(cmd, cmdMode); // Get %TEMP% path char tempPathDir[MAX_PATH]; @@ -73,9 +80,6 @@ int main() // Unload resource data UnlockResource(resDataHandle); - - // Get console handle - HANDLE cmd = GetStdHandle(STD_OUTPUT_HANDLE); // Get the handle to the desktop window HWND desktop = GetDesktopWindow();