mirror of
https://github.com/SChernykh/p2pool.git
synced 2024-08-18 20:48:46 -06:00
Disable console quick-edit mode on Windows
Prevent user from accidentally selecting text in console and freezing all output
This commit is contained in:
parent
111324b6e0
commit
6859d11445
@ -35,6 +35,7 @@ static volatile bool stopped = false;
|
|||||||
static volatile bool worker_started = false;
|
static volatile bool worker_started = false;
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
static const HANDLE hStdIn = GetStdHandle(STD_INPUT_HANDLE);
|
||||||
static const HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
|
static const HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||||
static const HANDLE hStdErr = GetStdHandle(STD_ERROR_HANDLE);
|
static const HANDLE hStdErr = GetStdHandle(STD_ERROR_HANDLE);
|
||||||
#endif
|
#endif
|
||||||
@ -69,6 +70,9 @@ public:
|
|||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
DWORD dwConsoleMode;
|
DWORD dwConsoleMode;
|
||||||
|
if (GetConsoleMode(hStdIn, &dwConsoleMode)) {
|
||||||
|
SetConsoleMode(hStdIn, dwConsoleMode & ~ENABLE_QUICK_EDIT_MODE);
|
||||||
|
}
|
||||||
if (GetConsoleMode(hStdOut, &dwConsoleMode)) {
|
if (GetConsoleMode(hStdOut, &dwConsoleMode)) {
|
||||||
SetConsoleMode(hStdOut, dwConsoleMode | ENABLE_VIRTUAL_TERMINAL_PROCESSING);
|
SetConsoleMode(hStdOut, dwConsoleMode | ENABLE_VIRTUAL_TERMINAL_PROCESSING);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user