| 95 | } |
| 96 | |
| 97 | void TaskViewVisibilityMonitor::ThreadMain() noexcept |
| 98 | { |
| 99 | s_ThreadRunning = true; |
| 100 | const auto guard = wil::scope_exit([]() noexcept |
| 101 | { |
| 102 | s_ThreadRunning = false; |
| 103 | FAIL_FAST_IF_WIN32_BOOL_FALSE(SetEvent(s_ThreadCleanupEvent.get())); |
| 104 | }); |
| 105 | |
| 106 | const auto coInitialize = wil::CoInitializeEx_failfast(COINIT_APARTMENTTHREADED); |
| 107 | const auto viewService = LoadViewService(); |
| 108 | const auto token = RegisterSink(); |
| 109 | |
| 110 | unique_window_failfast window(CreateWindowEx(WS_EX_NOREDIRECTIONBITMAP, reinterpret_cast<LPCWSTR>(s_WindowClassAtom.get()), TTBHOOK_TASKVIEWMONITOR.c_str(), 0, 0, 0, 0, 0, HWND_MESSAGE, nullptr, wil::GetModuleInstanceHandle(), nullptr)); |
| 111 | FAIL_FAST_LAST_ERROR_IF_NULL(window); |
| 112 | |
| 113 | BOOL ret; |
| 114 | MSG msg; |
| 115 | while ((ret = GetMessage(&msg, nullptr, 0, 0)) != 0) |
| 116 | { |
| 117 | FAIL_FAST_LAST_ERROR_IF(ret == -1); |
| 118 | |
| 119 | TranslateMessage(&msg); |
| 120 | DispatchMessage(&msg); |
| 121 | } |
| 122 | } |
| 123 | |
| 124 | DWORD WINAPI TaskViewVisibilityMonitor::ThreadProc(LPVOID) noexcept |
| 125 | { |