Handle window messages to toggle recording on/off
| 169 | |
| 170 | // Handle window messages to toggle recording on/off |
| 171 | static LRESULT CALLBACK HandleWindowMessage(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) |
| 172 | { |
| 173 | auto const& args = GetCommandLineArgs(); |
| 174 | |
| 175 | switch (uMsg) { |
| 176 | case WM_TIMER: |
| 177 | switch (wParam) { |
| 178 | case DELAY_TIMER_ID: |
| 179 | StartRecording(); |
| 180 | KillTimer(hWnd, DELAY_TIMER_ID); |
| 181 | return 0; |
| 182 | |
| 183 | case TIMED_TIMER_ID: |
| 184 | StopRecording(); |
| 185 | if (args.mTerminateAfterTimer) { |
| 186 | ExitMainThread(); |
| 187 | } |
| 188 | return 0; |
| 189 | |
| 190 | case ETW_STATUS_TIMER_ID: |
| 191 | OutputEtwStatus(); |
| 192 | return 0; |
| 193 | } |
| 194 | break; |
| 195 | |
| 196 | case WM_HOTKEY: |
| 197 | if (gHotkeyIgnoreCount > 0) { |
| 198 | gHotkeyIgnoreCount -= 1; |
| 199 | break; |
| 200 | } |
| 201 | |
| 202 | if (IsRecording()) { |
| 203 | StopRecording(); |
| 204 | } else if (args.mDelay == 0) { |
| 205 | StartRecording(); |
| 206 | } else { |
| 207 | SetTimer(hWnd, DELAY_TIMER_ID, args.mDelay * 1000, (TIMERPROC) nullptr); |
| 208 | } |
| 209 | return 0; |
| 210 | } |
| 211 | |
| 212 | return DefWindowProc(hWnd, uMsg, wParam, lParam); |
| 213 | } |
| 214 | |
| 215 | void ExitMainThread() |
| 216 | { |
nothing calls this directly
no test coverage detected