diff --git a/src/modules/ZoomIt/ZoomIt/ZoomIt.vcxproj b/src/modules/ZoomIt/ZoomIt/ZoomIt.vcxproj index a0b35a6a82..e98e0661a2 100644 --- a/src/modules/ZoomIt/ZoomIt/ZoomIt.vcxproj +++ b/src/modules/ZoomIt/ZoomIt/ZoomIt.vcxproj @@ -90,7 +90,7 @@ $(InterPlatformDir) - comctl32.lib;odbc32.lib;odbccp32.lib;Winmm.lib;gdiplus.lib;Msimg32.lib;%(AdditionalDependencies) + Shlwapi.lib;comctl32.lib;odbc32.lib;odbccp32.lib;Winmm.lib;gdiplus.lib;Msimg32.lib;%(AdditionalDependencies) true Windows true @@ -111,7 +111,7 @@ 0x0409 - comctl32.lib;odbc32.lib;odbccp32.lib;Winmm.lib;gdiplus.lib;Msimg32.lib;%(AdditionalDependencies) + Shlwapi.lib;comctl32.lib;odbc32.lib;odbccp32.lib;Winmm.lib;gdiplus.lib;Msimg32.lib;%(AdditionalDependencies) true Windows true @@ -133,7 +133,7 @@ 0x0409 - comctl32.lib;odbc32.lib;odbccp32.lib;Winmm.lib;gdiplus.lib;Msimg32.lib;%(AdditionalDependencies) + Shlwapi.lib;comctl32.lib;odbc32.lib;odbccp32.lib;Winmm.lib;gdiplus.lib;Msimg32.lib;%(AdditionalDependencies) true Windows @@ -154,7 +154,7 @@ $(InterPlatformDir) - comctl32.lib;odbc32.lib;odbccp32.lib;Winmm.lib;gdiplus.lib;Msimg32.lib;%(AdditionalDependencies) + Shlwapi.lib;comctl32.lib;odbc32.lib;odbccp32.lib;Winmm.lib;gdiplus.lib;Msimg32.lib;%(AdditionalDependencies) true Windows false @@ -174,7 +174,7 @@ 0x0409 - comctl32.lib;odbc32.lib;odbccp32.lib;Winmm.lib;gdiplus.lib;Msimg32.lib;%(AdditionalDependencies) + Shlwapi.lib;comctl32.lib;odbc32.lib;odbccp32.lib;Winmm.lib;gdiplus.lib;Msimg32.lib;%(AdditionalDependencies) true true Windows @@ -195,7 +195,7 @@ 0x0409 - comctl32.lib;odbc32.lib;odbccp32.lib;Winmm.lib;gdiplus.lib;Msimg32.lib;%(AdditionalDependencies) + Shlwapi.lib;comctl32.lib;odbc32.lib;odbccp32.lib;Winmm.lib;gdiplus.lib;Msimg32.lib;%(AdditionalDependencies) true true Windows diff --git a/src/modules/ZoomIt/ZoomIt/Zoomit.cpp b/src/modules/ZoomIt/ZoomIt/Zoomit.cpp index eb7d2085b1..e2f4fd0cb5 100644 --- a/src/modules/ZoomIt/ZoomIt/Zoomit.cpp +++ b/src/modules/ZoomIt/ZoomIt/Zoomit.cpp @@ -15,6 +15,7 @@ #include "ZoomItSettings.h" #include #include +#include namespace winrt { @@ -3498,6 +3499,45 @@ void UpdateMonitorInfo( POINT point, MONITORINFO* monInfo ) } } + HRESULT OpenPowerToysSettingsApp() + { + std::wstring path = get_module_folderpath(g_hInstance); + path += L"\\PowerToys.exe"; + + std::wstring openSettings = L"--open-settings=ZoomIt"; + + std::wstring full_command_path = path + L" " + openSettings; + + STARTUPINFO startupInfo; + ZeroMemory(&startupInfo, sizeof(STARTUPINFO)); + startupInfo.cb = sizeof(STARTUPINFO); + startupInfo.wShowWindow = SW_SHOWNORMAL; + + PROCESS_INFORMATION processInformation; + + CreateProcess( + path.c_str(), + full_command_path.data(), + NULL, + NULL, + TRUE, + 0, + NULL, + NULL, + &startupInfo, + &processInformation); + + if (!CloseHandle(processInformation.hProcess)) + { + return HRESULT_FROM_WIN32(GetLastError()); + } + if (!CloseHandle(processInformation.hThread)) + { + return HRESULT_FROM_WIN32(GetLastError()); + } + return S_OK; + } + //---------------------------------------------------------------------------- // // MainWndProc @@ -5910,8 +5950,12 @@ LRESULT APIENTRY MainWndProc( case IDC_OPTIONS: // Don't show win32 forms options if started by PowerToys. - // TODO: Call Settings app instead. - if (!g_StartedByPowerToys) + // Show the PowerToys Settings application instead. + if (g_StartedByPowerToys) + { + OpenPowerToysSettingsApp(); + } + else { DialogBox( g_hInstance, L"OPTIONS", hWnd, OptionsProc ); }