mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-09 04:37:30 +02:00
Don't wait for ColorPicker.exe to close (#5866)
This commit is contained in:
@@ -132,7 +132,7 @@ public:
|
|||||||
{
|
{
|
||||||
if (m_enabled)
|
if (m_enabled)
|
||||||
{
|
{
|
||||||
terminateProcess();
|
TerminateProcess(m_hProcess, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_enabled = false;
|
m_enabled = false;
|
||||||
@@ -142,28 +142,6 @@ public:
|
|||||||
{
|
{
|
||||||
return m_enabled;
|
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()
|
extern "C" __declspec(dllexport) PowertoyModuleIface* __cdecl powertoy_create()
|
||||||
|
|||||||
Reference in New Issue
Block a user