SmartRename icon indicating copy to clipboard operation
SmartRename copied to clipboard

Let the dialog appear in the center of the screen

Open laoqiuqiu opened this issue 4 years ago • 1 comments

I copied a piece of code, add to "PowerRenameUI.h" After 89 lines

			RECT rcDlg;
			GetWindowRect(pDlg->m_hwnd, &rcDlg);
			RECT rcParent;
			HWND hWndParent = GetParent(pDlg->m_hwnd);
			GetClientRect(hWndParent, &rcParent);
			POINT ptParentInScreen;
			ptParentInScreen.x = rcParent.left;
			ptParentInScreen.y = rcParent.top;
			::ClientToScreen(hWndParent, (LPPOINT)&ptParentInScreen);
			SetWindowPos(pDlg->m_hwnd, NULL, ptParentInScreen.x + (rcParent.right - rcParent.left - (rcDlg.right - rcDlg.left)) / 2, ptParentInScreen.y + (rcParent.bottom - rcParent.top - (rcDlg.bottom - rcDlg.top)) / 2, 0, 0, SWP_NOZORDER | SWP_NOSIZE);

laoqiuqiu avatar Nov 01 '19 07:11 laoqiuqiu

Thanks! I'll experiment with this. I did update the code in the latest release to properly specify the window it was invoked from. https://github.com/chrdavis/SmartRename/releases/tag/v1.0.1

chrdavis avatar Nov 02 '19 06:11 chrdavis