From 3356ceee6738f7cde6eddbe960d77fe3b3b44fd3 Mon Sep 17 00:00:00 2001 From: taynpg Date: Tue, 21 Jan 2025 14:47:42 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E4=BF=AE=E6=AD=A3win=E4=B8=8B?= =?UTF-8?q?=E7=BC=96=E8=AF=91=E5=92=8C=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/main.cpp | 18 ++++++++++++++++++ util/util.h | 1 + 2 files changed, 19 insertions(+) diff --git a/client/main.cpp b/client/main.cpp index 7ac05b2..45fcd48 100644 --- a/client/main.cpp +++ b/client/main.cpp @@ -5,6 +5,15 @@ #include #include +#ifdef _WIN32 +#include +#include +#include +#ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING +#define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004 +#endif +#endif + std::shared_ptr g_Logger = nullptr; std::shared_ptr g_Config = nullptr; @@ -85,6 +94,15 @@ bool exec_cmd(const CmdParam& param, bool& run) int main(int argc, char* argv[]) { + +#ifdef _WIN32 + HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE); + DWORD mode; + GetConsoleMode(hConsole, &mode); + mode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING; + SetConsoleMode(hConsole, mode); +#endif + g_Config = std::make_shared(); if (!g_Config->baseInit()) { return -1; diff --git a/util/util.h b/util/util.h index 5704f4b..7758572 100644 --- a/util/util.h +++ b/util/util.h @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include