MCPcopy Create free account
hub / github.com/GameTechDev/PresentMon / HandleWindowMessage

Function HandleWindowMessage

PresentMon/MainThread.cpp:171–213  ·  view source on GitHub ↗

Handle window messages to toggle recording on/off

Source from the content-addressed store, hash-verified

169
170// Handle window messages to toggle recording on/off
171static 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
215void ExitMainThread()
216{

Callers

nothing calls this directly

Calls 5

StartRecordingFunction · 0.85
StopRecordingFunction · 0.85
ExitMainThreadFunction · 0.85
OutputEtwStatusFunction · 0.85
IsRecordingFunction · 0.85

Tested by

no test coverage detected