| 61 | } |
| 62 | |
| 63 | bool Create(const wchar_t *window_class) { |
| 64 | class_name = window_class; |
| 65 | HINSTANCE hinst = GetModuleHandleW(nullptr); |
| 66 | |
| 67 | WNDCLASSW wc = {}; |
| 68 | wc.lpfnWndProc = NamedClassColorWindow::WndProc; |
| 69 | wc.hInstance = hinst; |
| 70 | wc.lpszClassName = class_name; |
| 71 | if (!RegisterClassW(&wc) && GetLastError() != ERROR_CLASS_ALREADY_EXISTS) |
| 72 | return false; |
| 73 | |
| 74 | hwnd = CreateWindowExW(0, class_name, L"op-normal-auto-test", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, |
| 75 | CW_USEDEFAULT, 220, 180, nullptr, nullptr, hinst, this); |
| 76 | if (!hwnd) |
| 77 | return false; |
| 78 | ShowWindow(hwnd, SW_SHOW); |
| 79 | UpdateWindow(hwnd); |
| 80 | return IsWindow(hwnd); |
| 81 | } |
| 82 | |
| 83 | ~NamedClassColorWindow() { |
| 84 | if (hwnd) |