mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
[FancyZones]Set FancyZones process and main thread priority to Normal (#28581)
This commit is contained in:
@@ -48,6 +48,13 @@ int WINAPI wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance,
|
||||
return 0;
|
||||
}
|
||||
|
||||
auto process = GetCurrentProcess();
|
||||
if (!SetPriorityClass(process, NORMAL_PRIORITY_CLASS))
|
||||
{
|
||||
std::wstring err = get_last_error_or_default(GetLastError());
|
||||
Logger::warn(L"Failed to set priority to FancyZones: {}", err);
|
||||
}
|
||||
|
||||
std::wstring pid = std::wstring(lpCmdLine);
|
||||
if (!pid.empty())
|
||||
{
|
||||
|
||||
@@ -71,6 +71,11 @@ public:
|
||||
PostMessageW(m_window, WM_PRIV_LOCATIONCHANGE, NULL, NULL);
|
||||
})
|
||||
{
|
||||
if (!SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_NORMAL))
|
||||
{
|
||||
Logger::warn("Failed to set main thread priority");
|
||||
}
|
||||
|
||||
this->disableModuleCallback = std::move(disableModuleCallbackFunction);
|
||||
|
||||
FancyZonesSettings::instance().LoadSettings();
|
||||
|
||||
Reference in New Issue
Block a user