[FancyZones]Set FancyZones process and main thread priority to Normal (#28581)

This commit is contained in:
Seraphima Zykova
2023-09-19 17:47:05 +03:00
committed by GitHub
parent e09839dd6e
commit bdf9a44717
2 changed files with 12 additions and 0 deletions

View File

@@ -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())
{

View File

@@ -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();