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

Function HandleCtrlEvent

PresentMon/MainThread.cpp:153–168  ·  view source on GitHub ↗

Handle Ctrl events (CTRL_C_EVENT, CTRL_BREAK_EVENT, CTRL_CLOSE_EVENT, CTRL_LOGOFF_EVENT, CTRL_SHUTDOWN_EVENT) by redirecting the termination into a WM_QUIT message so that the shutdown code is still executed.

Source from the content-addressed store, hash-verified

151// CTRL_LOGOFF_EVENT, CTRL_SHUTDOWN_EVENT) by redirecting the termination into
152// a WM_QUIT message so that the shutdown code is still executed.
153static BOOL CALLBACK HandleCtrlEvent(DWORD ctrlType)
154{
155 (void) ctrlType;
156 if (IsRecording()) {
157 StopRecording();
158 }
159 ExitMainThread();
160
161 // The other threads are now shutting down but if we return the system may
162 // terminate the process before they complete, which may leave the trace
163 // session open. We could wait for shutdown confirmation, but this
164 // function is run in a separate thread so we just put it to sleep
165 // indefinately and let the application shut itself down.
166 Sleep(INFINITE);
167 return TRUE; // The signal was handled, don't call any other handlers
168}
169
170// Handle window messages to toggle recording on/off
171static LRESULT CALLBACK HandleWindowMessage(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)

Callers

nothing calls this directly

Calls 3

IsRecordingFunction · 0.85
StopRecordingFunction · 0.85
ExitMainThreadFunction · 0.85

Tested by

no test coverage detected