Run the message pump for one thread.
| 136 | |
| 137 | // Run the message pump for one thread. |
| 138 | static int RunMessagePump() |
| 139 | { |
| 140 | HACCEL hAccelTable = LoadAccelerators(g_hInstance, MAKEINTRESOURCE(IDC_WEBVIEW2APISAMPLE)); |
| 141 | |
| 142 | MSG msg; |
| 143 | |
| 144 | // Main message loop: |
| 145 | //! [MoveFocus0] |
| 146 | while (GetMessage(&msg, nullptr, 0, 0)) |
| 147 | { |
| 148 | if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) |
| 149 | { |
| 150 | // Calling IsDialogMessage handles Tab traversal automatically. If the |
| 151 | // app wants the platform to auto handle tab, then call IsDialogMessage |
| 152 | // before calling TranslateMessage/DispatchMessage. If the app wants to |
| 153 | // handle tabbing itself, then skip calling IsDialogMessage and call |
| 154 | // TranslateMessage/DispatchMessage directly. |
| 155 | if (!g_autoTabHandle || !IsDialogMessage(GetAncestor(msg.hwnd, GA_ROOT), &msg)) |
| 156 | { |
| 157 | TranslateMessage(&msg); |
| 158 | DispatchMessage(&msg); |
| 159 | } |
| 160 | } |
| 161 | } |
| 162 | //! [MoveFocus0] |
| 163 | |
| 164 | DWORD threadId = GetCurrentThreadId(); |
| 165 | auto it = s_threads.find(threadId); |
| 166 | if (it != s_threads.end()) |
| 167 | { |
| 168 | CloseHandle(it->second); |
| 169 | s_threads.erase(threadId); |
| 170 | } |
| 171 | |
| 172 | return (int)msg.wParam; |
| 173 | } |
| 174 | |
| 175 | // Make a new thread. |
| 176 | void CreateNewThread(AppWindow* app) |
no outgoing calls
no test coverage detected