From 83de1686c0b349d1eee970cfb5a4a443414e3c52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Sto=C5=A1i=C4=87?= Date: Tue, 11 Aug 2020 17:06:28 +0200 Subject: [PATCH] Don't wait for ColorPicker.exe to close (#5866) --- .../colorPicker/ColorPicker/dllmain.cpp | 24 +------------------ 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/src/modules/colorPicker/ColorPicker/dllmain.cpp b/src/modules/colorPicker/ColorPicker/dllmain.cpp index f8c0c0cc25..7f92611704 100644 --- a/src/modules/colorPicker/ColorPicker/dllmain.cpp +++ b/src/modules/colorPicker/ColorPicker/dllmain.cpp @@ -132,7 +132,7 @@ public: { if (m_enabled) { - terminateProcess(); + TerminateProcess(m_hProcess, 1); } m_enabled = false; @@ -142,28 +142,6 @@ public: { return m_enabled; } - - static BOOL CALLBACK requestMainWindowClose(HWND nextWindow, LPARAM closePid) - { - DWORD windowPid; - GetWindowThreadProcessId(nextWindow, &windowPid); - - if (windowPid == (DWORD)closePid) - ::PostMessage(nextWindow, WM_CLOSE, 0, 0); - - return true; - } - - void terminateProcess() - { - DWORD processID = GetProcessId(m_hProcess); - EnumWindows(&requestMainWindowClose, processID); - const DWORD result = WaitForSingleObject(m_hProcess, MAX_WAIT_MILLISEC); - if (result == WAIT_TIMEOUT) - { - TerminateProcess(m_hProcess, 1); - } - } }; extern "C" __declspec(dllexport) PowertoyModuleIface* __cdecl powertoy_create()