diff --git a/src/modules/powerrename/PowerRenameUILib/MainWindow.xaml.cpp b/src/modules/powerrename/PowerRenameUILib/MainWindow.xaml.cpp index 448a7a5aab..5a09178ce8 100644 --- a/src/modules/powerrename/PowerRenameUILib/MainWindow.xaml.cpp +++ b/src/modules/powerrename/PowerRenameUILib/MainWindow.xaml.cpp @@ -47,6 +47,29 @@ namespace winrt::PowerRenameUI::implementation Microsoft::UI::WindowId windowId = Microsoft::UI::GetWindowIdFromWindow(m_window); + POINT cursorPosition{}; + if (GetCursorPos(&cursorPosition)) + { + HMONITOR hMonitor = MonitorFromPoint(cursorPosition, MONITOR_DEFAULTTOPRIMARY); + MONITORINFOEX monitorInfo; + monitorInfo.cbSize = sizeof(MONITORINFOEX); + GetMonitorInfo(hMonitor, &monitorInfo); + RECT rect; + if (GetWindowRect(m_window, &rect)) + { + int width = rect.right - rect.left; + int height = rect.bottom - rect.top; + + MoveWindow(m_window, + monitorInfo.rcWork.left + (monitorInfo.rcWork.right - monitorInfo.rcWork.left - width) / 2, + monitorInfo.rcWork.top + (monitorInfo.rcWork.bottom - monitorInfo.rcWork.top - height) / 2, + width, + height, + true); + } + } + + Microsoft::UI::Windowing::AppWindow appWindow = Microsoft::UI::Windowing::AppWindow::GetFromWindowId(windowId); appWindow.SetIcon(PowerRenameUIIco); @@ -107,7 +130,7 @@ namespace winrt::PowerRenameUI::implementation CComPtr shellItemArray; // To test PowerRename uncomment this line and update the path to // your local (absolute or relative) path which you want to see in PowerRename - // files.push_back(); + // g_files.push_back(); if (!g_files.empty()) { diff --git a/src/modules/powerrename/PowerRenameUILib/PowerRenameUI.vcxproj b/src/modules/powerrename/PowerRenameUILib/PowerRenameUI.vcxproj index 62a2ad79fa..29a985d0d0 100644 --- a/src/modules/powerrename/PowerRenameUILib/PowerRenameUI.vcxproj +++ b/src/modules/powerrename/PowerRenameUILib/PowerRenameUI.vcxproj @@ -150,10 +150,9 @@ - Always + Always - <_WildCardPRIResource Include="Strings\*\Resources.resw" /> @@ -161,6 +160,9 @@ {d9b8fc84-322a-4f9f-bbb9-20915c47ddfd} + + {cc6e41ac-8174-4e8a-8d22-85dd7f4851df} + {51920f1f-c28c-4adf-8660-4238766796c2} diff --git a/src/modules/powerrename/PowerRenameUILib/PowerRenameUI.vcxproj.filters b/src/modules/powerrename/PowerRenameUILib/PowerRenameUI.vcxproj.filters index 2ce9e8ea54..546f16948e 100644 --- a/src/modules/powerrename/PowerRenameUILib/PowerRenameUI.vcxproj.filters +++ b/src/modules/powerrename/PowerRenameUILib/PowerRenameUI.vcxproj.filters @@ -44,7 +44,4 @@ - - - \ No newline at end of file