| 1 |
#define _WIN32_WINNT 0x0501 |
| 2 |
#include <stdio.h> |
| 3 |
#include <windows.h> |
| 4 |
|
| 5 |
#include "../src/shared/DebugClient.cc" |
| 6 |
|
| 7 |
const int SC_CONSOLE_MARK = 0xFFF2; |
| 8 |
const int SC_CONSOLE_SELECT_ALL = 0xFFF5; |
| 9 |
|
| 10 |
CALLBACK DWORD pausingThread(LPVOID dummy) |
| 11 |
{ |
| 12 |
HWND hwnd = GetConsoleWindow(); |
| 13 |
while (true) { |
| 14 |
SendMessage(hwnd, WM_SYSCOMMAND, SC_CONSOLE_SELECT_ALL, 0); |
| 15 |
Sleep(1000); |
| 16 |
SendMessage(hwnd, WM_CHAR, 27, 0x00010001); |
| 17 |
Sleep(1000); |
| 18 |
} |
| 19 |
} |
| 20 |
|
| 21 |
int main() |
| 22 |
{ |
| 23 |
HANDLE out = GetStdHandle(STD_OUTPUT_HANDLE); |
| 24 |
CONSOLE_SCREEN_BUFFER_INFO info; |
| 25 |
|
| 26 |
GetConsoleScreenBufferInfo(out, &info); |
| 27 |
COORD initial = info.dwCursorPosition; |
| 28 |
|
| 29 |
CreateThread(NULL, 0, |
| 30 |
pausingThread, NULL, |
| 31 |
0, NULL); |
| 32 |
|
| 33 |
for (int i = 0; i < 30; ++i) { |
| 34 |
Sleep(100); |
| 35 |
GetConsoleScreenBufferInfo(out, &info); |
| 36 |
if (memcmp(&info.dwCursorPosition, &initial, sizeof(COORD)) != 0) { |
| 37 |
trace("cursor moved to [%d,%d]", |
| 38 |
info.dwCursorPosition.X, |
| 39 |
info.dwCursorPosition.Y); |
| 40 |
} else { |
| 41 |
trace("cursor in expected position"); |
| 42 |
} |
| 43 |
} |
| 44 |
return 0; |
| 45 |
} |