File size: 990 Bytes
19605ab |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
#define _WIN32_WINNT 0x0501
#include "../src/shared/DebugClient.cc"
#include <windows.h>
#include <stdio.h>
const int SC_CONSOLE_MARK = 0xFFF2;
CALLBACK DWORD writerThread(void*)
{
while (true) {
Sleep(1000);
trace("writing");
printf("X\n");
trace("written");
}
}
int main()
{
CreateThread(NULL, 0, writerThread, NULL, 0, NULL);
trace("marking console");
HWND hwnd = GetConsoleWindow();
PostMessage(hwnd, WM_SYSCOMMAND, SC_CONSOLE_MARK, 0);
Sleep(2000);
trace("reading output");
CHAR_INFO buf[1];
COORD bufSize = { 1, 1 };
COORD zeroCoord = { 0, 0 };
SMALL_RECT readRect = { 0, 0, 0, 0 };
ReadConsoleOutput(GetStdHandle(STD_OUTPUT_HANDLE),
buf,
bufSize,
zeroCoord,
&readRect);
trace("done reading output");
Sleep(2000);
PostMessage(hwnd, WM_CHAR, 27, 0x00010001);
Sleep(1100);
return 0;
}
|