Gameprocesswatcher.cpp Apr 2026
void GameProcessWatcher::setOnProcessExit(std::function<void(DWORD)> callback) std::lock_guard<std::mutex> lock(m_mutex); m_onProcessExit = callback;
bool GameProcessWatcher::startWatching(int intervalMs) m_hProcess == nullptr) m_lastError = "No valid process selected"; return false; if (m_isWatching) return true; // Already watching m_checkInterval = intervalMs; m_isWatching = true; m_watchThread = std::thread(&GameProcessWatcher::watchLoop, this); return true; gameprocesswatcher.cpp
bool GameProcessWatcher::openProcessById(DWORD processId) PROCESS_VM_OPERATION m_onProcessExit = callback
// Process control bool terminateProcess(); if (m_isWatching) return true
bool GameProcessWatcher::terminateProcess() if (m_hProcess == nullptr) return false; if (!TerminateProcess(m_hProcess, 0)) m_lastError = "Failed to terminate process. Error: " + std::to_string(GetLastError()); return false; closeProcessHandle(); return true;
bool GameProcessWatcher::setProcessById(DWORD processId) std::lock_guard<std::mutex> lock(m_mutex); return openProcessById(processId);