Skip to content

Commit

Permalink
Improve the SelectAllTest a little
Browse files Browse the repository at this point in the history
  • Loading branch information
rprichard committed Nov 6, 2015
1 parent 2e24ecd commit 5fb236d
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions misc/SelectAllTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#include <stdio.h>
#include <windows.h>

#include "../shared/DebugClient.cc"

const int SC_CONSOLE_MARK = 0xFFF2;
const int SC_CONSOLE_SELECT_ALL = 0xFFF5;

Expand All @@ -10,7 +12,9 @@ CALLBACK DWORD pausingThread(LPVOID dummy)
HWND hwnd = GetConsoleWindow();
while (true) {
SendMessage(hwnd, WM_SYSCOMMAND, SC_CONSOLE_SELECT_ALL, 0);
Sleep(1000);
SendMessage(hwnd, WM_CHAR, 27, 0x00010001);
Sleep(1000);
}
}

Expand All @@ -26,14 +30,15 @@ int main()
pausingThread, NULL,
0, NULL);

while (true) {
for (int i = 0; i < 30; ++i) {
Sleep(100);
GetConsoleScreenBufferInfo(out, &info);
if (memcmp(&info.dwCursorPosition, &initial, sizeof(COORD)) != 0) {
printf("cursor moved to [%d,%d]\n",
trace("cursor moved to [%d,%d]",
info.dwCursorPosition.X,
info.dwCursorPosition.Y);
GetConsoleScreenBufferInfo(out, &info);
initial = info.dwCursorPosition;
} else {
trace("cursor in expected position");
}
}
return 0;
Expand Down

0 comments on commit 5fb236d

Please sign in to comment.