UNPKG

799 Btext/x-cView Raw
1#include <windows.h>
2
3#include "TestUtil.cc"
4
5int main(int argc, char *argv[]) {
6 if (argc != 3 && argc != 5) {
7 printf("Usage: %s x y\n", argv[0]);
8 printf("Usage: %s x y width height\n", argv[0]);
9 return 1;
10 }
11
12 HWND hwnd = GetConsoleWindow();
13
14 const int x = atoi(argv[1]);
15 const int y = atoi(argv[2]);
16
17 int w = 0, h = 0;
18 if (argc == 3) {
19 RECT r = {};
20 BOOL ret = GetWindowRect(hwnd, &r);
21 ASSERT(ret && "GetWindowRect failed on console window");
22 w = r.right - r.left;
23 h = r.bottom - r.top;
24 } else {
25 w = atoi(argv[3]);
26 h = atoi(argv[4]);
27 }
28
29 BOOL ret = MoveWindow(hwnd, x, y, w, h, TRUE);
30 trace("MoveWindow: ret=%d", ret);
31 printf("MoveWindow: ret=%d\n", ret);
32
33 return 0;
34}