diff --git a/src/Dialogs.c b/src/Dialogs.c index d4bb10ad2..73a568944 100644 --- a/src/Dialogs.c +++ b/src/Dialogs.c @@ -101,10 +101,7 @@ static LRESULT CALLBACK SetPosRelatedToParent_Hook(INT nCode, WPARAM wParam, LPA rcDlg.right = pCreateStruct->x + pCreateStruct->cx; rcDlg.bottom = pCreateStruct->y + pCreateStruct->cy; - RECT rcParent = { 0 }; - GetWindowRectEx(hParentWnd, &rcParent); - - POINT const ptTopLeft = GetCenterOfDlgInParent(&rcDlg, &rcParent); + POINT const ptTopLeft = GetCenterOfDlgInParent(&rcDlg, hParentWnd); pCreateStruct->x = ptTopLeft.x; pCreateStruct->y = ptTopLeft.y; @@ -284,6 +281,32 @@ static INT_PTR CALLBACK _InfoBoxLngDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, //UINT const tabStopDist[3] = { 4, 4, 8 }; //SendMessage(GetDlgItem(hwnd, IDC_INFOBOXTEXT), EM_SETTABSTOPS, 3, (LPARAM)tabStopDist); + +#if 0 + // Resize dialog to fit text - TODO: move buttons dynamically too + HWND const hWndText = GetDlgItem(hwnd, IDC_INFOBOXTEXT); + RECT rectText = { 0 }; + GetWindowRectEx(hWndText, &rectText); + + RECT rectNew = { 0 }; + rectNew.left = 0; + rectNew.top = 0; + rectNew.right = rectText.right - rectText.left; // max as specified + rectNew.bottom = rectNew.right; // max quadratic size + + HDC hdc = GetDC(hWndText); + DrawText(hdc, lpMsgBox->lpstrMessage, -1, &rectNew, DT_CALCRECT | DT_WORDBREAK); // calc size + ReleaseDC(hWndText, hdc); + + // Change size of text field + SetWindowPos(hWndText, NULL, 0, 0, rectNew.right - rectNew.left, rectNew.bottom - rectNew.top, SWP_NOMOVE | SWP_NOZORDER); + //GetWindowRect(hWndText, &rectText); + + int const width = (rectNew.right - rectNew.left) + 100; + int const height = (rectNew.bottom - rectNew.top) + 200; + SetWindowPos(hwnd, NULL, 0, 0, width, height, SWP_NOMOVE | SWP_NOZORDER); +#endif + SetDlgItemText(hwnd, IDC_INFOBOXTEXT, lpMsgBox->lpstrMessage); if (lpMsgBox->bDisableCheckBox) { @@ -294,7 +317,7 @@ static INT_PTR CALLBACK _InfoBoxLngDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, FreeMem(lpMsgBox->lpstrMessage); lpMsgBox->lpstrMessage = NULL; - CenterDlgInParent(hwnd, NULL); + CenterDlgInParent(hwnd, NULL, true); AttentionBeep(lpMsgBox->uType); } return TRUE; @@ -811,7 +834,7 @@ static INT_PTR CALLBACK CmdLineHelpProc(HWND hwnd, UINT umsg, WPARAM wParam, LPA WCHAR szText[4096] = { L'\0' }; GetLngString(IDS_MUI_CMDLINEHELP, szText, COUNTOF(szText)); SetDlgItemText(hwnd, IDC_CMDLINEHELP, szText); - CenterDlgInParent(hwnd, NULL); + CenterDlgInParent(hwnd, NULL, false); } return TRUE; @@ -1042,7 +1065,7 @@ INT_PTR CALLBACK AboutDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam StringCchCatA(pAboutResource, COUNTOF(pAboutResource), pAboutRes); //~} - CenterDlgInParent(hwnd, NULL); + CenterDlgInParent(hwnd, NULL, false); HFONT const hFont = (HFONT)SendDlgItemMessage(hwnd, IDC_SCI_VERSION, WM_GETFONT, 0, 0); if (hFont) { @@ -1365,7 +1388,7 @@ static INT_PTR CALLBACK RunDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM l SetDlgItemText(hwnd, IDC_COMMANDLINE, (LPCWSTR)lParam); SHAutoComplete(GetDlgItem(hwnd, IDC_COMMANDLINE), SHACF_FILESYSTEM); - CenterDlgInParent(hwnd, NULL); + CenterDlgInParent(hwnd, NULL, false); } return TRUE; @@ -1622,7 +1645,7 @@ static INT_PTR CALLBACK OpenWithDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM MakeBitmapButton(hwnd,IDC_GETOPENWITHDIR,IDB_OPEN, -1, -1); - CenterDlgInParent(hwnd, NULL); + CenterDlgInParent(hwnd, NULL, false); } return TRUE; @@ -1882,7 +1905,7 @@ static INT_PTR CALLBACK FavoritesDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARA MakeBitmapButton(hwnd,IDC_GETFAVORITESDIR,IDB_OPEN, -1, -1); - CenterDlgInParent(hwnd, NULL); + CenterDlgInParent(hwnd, NULL, false); } return TRUE; @@ -2100,7 +2123,7 @@ static INT_PTR CALLBACK AddToFavDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, LPA SendDlgItemMessage(hwnd, IDC_ADDFAV_FILES, EM_LIMITTEXT, INTERNET_MAX_URL_LENGTH, 0); // max SetDlgItemTextW(hwnd, IDC_ADDFAV_FILES, wchNamePth); - CenterDlgInParent(hwnd, NULL); + CenterDlgInParent(hwnd, NULL, false); } return TRUE; @@ -2376,7 +2399,7 @@ static INT_PTR CALLBACK FileMRUDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, LPAR DialogEnableControl(hwnd, IDC_PRESERVECARET, Settings.SaveRecentFiles); - CenterDlgInParent(hwnd, NULL); + CenterDlgInParent(hwnd, NULL, false); } return TRUE; @@ -2722,7 +2745,7 @@ static INT_PTR CALLBACK ChangeNotifyDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, SetDlgItemInt(hwnd, IDC_FILE_CHECK_INTERVAL, (UINT)FileWatching.FileCheckInterval, FALSE); - CenterDlgInParent(hwnd, NULL); + CenterDlgInParent(hwnd, NULL, false); } return TRUE; @@ -2910,7 +2933,7 @@ static INT_PTR CALLBACK ColumnWrapDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, L UINT const uiNumber = *((UINT*)lParam); SetDlgItemInt(hwnd, IDC_COLUMNWRAP, uiNumber, false); SendDlgItemMessage(hwnd, IDC_COLUMNWRAP, EM_LIMITTEXT, 15, 0); - CenterDlgInParent(hwnd, NULL); + CenterDlgInParent(hwnd, NULL, false); } return TRUE; @@ -3054,7 +3077,7 @@ static INT_PTR CALLBACK WordWrapSettingsDlgProc(HWND hwnd, UINT umsg, WPARAM wPa SendDlgItemMessage(hwnd, 102, CB_SETCURSEL, (WPARAM)(Settings.ShowWordWrapSymbols ? ((Settings.WordWrapSymbols % 100) - (Settings.WordWrapSymbols % 10)) / 10 : 0), 0); SendDlgItemMessage(hwnd, 103, CB_SETCURSEL, (WPARAM)Settings.WordWrapMode, 0); - CenterDlgInParent(hwnd, NULL); + CenterDlgInParent(hwnd, NULL, false); } return TRUE; @@ -3194,7 +3217,7 @@ static INT_PTR CALLBACK LongLineSettingsDlgProc(HWND hwnd, UINT umsg, WPARAM wPa DialogEnableControl(hwnd, IDC_SHOWEDGELINE, false); DialogEnableControl(hwnd, IDC_BACKGRDCOLOR, false); } - CenterDlgInParent(hwnd, NULL); + CenterDlgInParent(hwnd, NULL, false); } return TRUE; @@ -3352,7 +3375,7 @@ static INT_PTR CALLBACK TabSettingsDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPA CheckDlgButton(hwnd,IDC_WARN_INCONSISTENT_INDENTS, SetBtn(Settings.WarnInconsistentIndents)); CheckDlgButton(hwnd,IDC_AUTO_DETECT_INDENTS, SetBtn(Settings.AutoDetectIndentSettings)); - CenterDlgInParent(hwnd, NULL); + CenterDlgInParent(hwnd, NULL, false); } return TRUE; @@ -3523,7 +3546,7 @@ static INT_PTR CALLBACK SelectDefEncodingDlgProc(HWND hwnd, UINT umsg, WPARAM wP CheckDlgButton(hwnd, IDC_NOUNICODEDETECTION, SetBtn(!Settings.SkipUnicodeDetection)); CheckDlgButton(hwnd, IDC_NOANSICPDETECTION, SetBtn(!Settings.SkipANSICodePageDetection)); - CenterDlgInParent(hwnd, NULL); + CenterDlgInParent(hwnd, NULL, false); } return TRUE; @@ -3719,7 +3742,7 @@ static INT_PTR CALLBACK SelectEncodingDlgProc(HWND hwnd,UINT umsg,WPARAM wParam, ListView_SetColumnWidth(hwndLV,0,LVSCW_AUTOSIZE_USEHEADER); - CenterDlgInParent(hwnd, NULL); + CenterDlgInParent(hwnd, NULL, false); } return TRUE; @@ -3926,7 +3949,7 @@ static INT_PTR CALLBACK SelectDefLineEndingDlgProc(HWND hwnd,UINT umsg,WPARAM wP CheckDlgButton(hwnd,IDC_CONSISTENT_EOLS, SetBtn(Settings.FixLineEndings)); CheckDlgButton(hwnd,IDC_AUTOSTRIPBLANKS, SetBtn(Settings.FixTrailingBlanks)); - CenterDlgInParent(hwnd, NULL); + CenterDlgInParent(hwnd, NULL, false); } return TRUE; @@ -4053,7 +4076,7 @@ static INT_PTR CALLBACK WarnLineEndingDlgProc(HWND hwnd, UINT umsg, WPARAM wPara } CheckDlgButton(hwnd, IDC_WARN_INCONSISTENT_EOLS, SetBtn(Settings.WarnInconsistEOLs)); - CenterDlgInParent(hwnd, NULL); + CenterDlgInParent(hwnd, NULL, false); AttentionBeep(MB_ICONEXCLAMATION); } @@ -4200,7 +4223,7 @@ static INT_PTR CALLBACK WarnIndentationDlgProc(HWND hwnd, UINT umsg, WPARAM wPar CheckDlgButton(hwnd, Globals.fvCurFile.bTabsAsSpaces ? IDC_INDENT_BY_SPCS : IDC_INDENT_BY_TABS, true); CheckDlgButton(hwnd, IDC_WARN_INCONSISTENT_INDENTS, SetBtn(Settings.WarnInconsistentIndents)); - CenterDlgInParent(hwnd, NULL); + CenterDlgInParent(hwnd, NULL, false); AttentionBeep(MB_ICONEXCLAMATION); } @@ -4332,7 +4355,7 @@ static INT_PTR CALLBACK AutoSaveBackupSettingsDlgProc(HWND hwnd, UINT umsg, WPAR } SetDlgItemText(hwnd, IDC_AUTOSAVE_INTERVAL, wch); - CenterDlgInParent(hwnd, NULL); + CenterDlgInParent(hwnd, NULL, false); } return TRUE; @@ -5508,10 +5531,19 @@ void ComboBox_AddStringMB2W(HWND hDlg, int nIDDlgItem, LPCSTR lpString) // // GetCenterOfDlgInParent() // -POINT GetCenterOfDlgInParent(const RECT* rcDlg, const RECT* rcParent) +POINT GetCenterOfDlgInParent(const RECT* rcDlg, const HWND hwndParent) { + RECT rcParent = { 0 }; - HMONITOR const hMonitor = MonitorFromRect(rcParent, MONITOR_DEFAULTTONEAREST); + WINDOWPLACEMENT wp = { sizeof(WINDOWPLACEMENT) }; + if (GetWindowPlacement(hwndParent, &wp)) { + rcParent = wp.rcNormalPosition; + } + else { + GetWindowRectEx(hwndParent, &rcParent); + } + + HMONITOR const hMonitor = MonitorFromRect(&rcParent, MONITOR_DEFAULTTONEAREST); MONITORINFO mi = { sizeof(MONITORINFO) }; GetMonitorInfo(hMonitor, &mi); int const xMin = mi.rcWork.left; @@ -5519,8 +5551,8 @@ POINT GetCenterOfDlgInParent(const RECT* rcDlg, const RECT* rcParent) int const yMin = mi.rcWork.top; int const yMax = (mi.rcWork.bottom) - (rcDlg->bottom - rcDlg->top); - int const x = rcParent->left + (((rcParent->right - rcParent->left) - (rcDlg->right - rcDlg->left)) >> 1); - int const y = rcParent->top + (((rcParent->bottom - rcParent->top) - (rcDlg->bottom - rcDlg->top)) >> 1); + int const x = rcParent.left + (((rcParent.right - rcParent.left) - (rcDlg->right - rcDlg->left)) >> 1); + int const y = rcParent.top + (((rcParent.bottom - rcParent.top) - (rcDlg->bottom - rcDlg->top)) >> 1); POINT ptRet = { 0, 0 }; ptRet.x = clampi(x, xMin, xMax); @@ -5544,7 +5576,7 @@ HWND GetParentOrDesktop(HWND hDlg) // // CenterDlgInParent() // -void CenterDlgInParent(HWND hDlg, HWND hDlgParent) +void CenterDlgInParent(HWND hDlg, HWND hDlgParent, bool bLock) { if (!hDlg) { return; } @@ -5552,13 +5584,14 @@ void CenterDlgInParent(HWND hDlg, HWND hDlgParent) GetWindowRect(hDlg, &rcDlg); HWND const hParentWnd = hDlgParent ? hDlgParent : GetParentOrDesktop(hDlg); - RECT rcParent = { 0 }; - GetWindowRectEx(hParentWnd, &rcParent); - POINT const ptTopLeft = GetCenterOfDlgInParent(&rcDlg, &rcParent); + POINT const ptTopLeft = GetCenterOfDlgInParent(&rcDlg, hParentWnd); SetWindowPos(hDlg, NULL, ptTopLeft.x, ptTopLeft.y, 0, 0, SWP_NOZORDER | SWP_NOSIZE); SetForegroundWindow(hDlg); + if (bLock) { + LockSetForegroundWindow(LSFW_LOCK); + } } @@ -6676,7 +6709,7 @@ INT_PTR CALLBACK FontDialogHookProc( //~ PostMessage(hdlg, WM_CLOSE, 0, 0); //~} - CenterDlgInParent(hdlg, NULL); + CenterDlgInParent(hdlg, NULL, false); PostMessage(hdlg, WM_THEMECHANGED, 0, 0); } break; @@ -6777,7 +6810,7 @@ INT_PTR CALLBACK ColorDialogHookProc( SetWindowPos(hdlg, NULL, wi.x, wi.y, wi.cx, wi.cy, SWP_NOZORDER | SWP_NOSIZE | SWP_SHOWWINDOW); SetForegroundWindow(hdlg); } else { - CenterDlgInParent(hdlg, NULL); + CenterDlgInParent(hdlg, NULL, false); } PostMessage(hdlg, WM_THEMECHANGED, 0, 0); diff --git a/src/Dialogs.h b/src/Dialogs.h index 0ca8325c8..418a991c1 100644 --- a/src/Dialogs.h +++ b/src/Dialogs.h @@ -127,9 +127,9 @@ void ComboBox_SetTextHW(HWND hDlg, int nIDDlgItem, const HSTRINGW hstr); void ComboBox_SetTextMB2W(HWND hDlg, int nIDDlgItem, LPCSTR lpString); //void ComboBox_AddStringMB2W(HWND hDlg, int nIDDlgItem, LPCSTR lpString); -POINT GetCenterOfDlgInParent(const RECT* rcDlg, const RECT* rcParent); +POINT GetCenterOfDlgInParent(const RECT* rcDlg, const HWND hwndParent); HWND GetParentOrDesktop(HWND hDlg); -void CenterDlgInParent(HWND hDlg, HWND hDlgParent); +void CenterDlgInParent(HWND hDlg, HWND hDlgParent, bool bLock); void GetDlgPos(HWND hDlg, LPINT xDlg, LPINT yDlg); void SetDlgPos(HWND hDlg, int xDlg, int yDlg); diff --git a/src/Edit.c b/src/Edit.c index 8b01ad084..5af32c86d 100644 --- a/src/Edit.c +++ b/src/Edit.c @@ -6377,7 +6377,7 @@ static INT_PTR CALLBACK EditFindReplaceDlgProc(HWND hwnd, UINT umsg, WPARAM wPar } else { if (Settings.FindReplaceDlgPosX == CW_USEDEFAULT || Settings.FindReplaceDlgPosY == CW_USEDEFAULT) { - CenterDlgInParent(hwnd, NULL); + CenterDlgInParent(hwnd, NULL, false); } else { SetDlgPos(hwnd, Settings.FindReplaceDlgPosX, Settings.FindReplaceDlgPosY); @@ -7028,7 +7028,7 @@ static INT_PTR CALLBACK EditFindReplaceDlgProc(HWND hwnd, UINT umsg, WPARAM wPar break; case IDACC_RESETPOS: - CenterDlgInParent(hwnd, NULL); + CenterDlgInParent(hwnd, NULL, false); Settings.FindReplaceDlgPosX = Settings.FindReplaceDlgPosY = CW_USEDEFAULT; break; @@ -8503,7 +8503,7 @@ static INT_PTR CALLBACK EditLinenumDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPA SetDlgItemInt(hwnd, IDC_COLNUM, (int)clampp(iCurColumn, 0, INT_MAX), false); SendDlgItemMessage(hwnd,IDC_LINENUM,EM_LIMITTEXT,80,0); SendDlgItemMessage(hwnd,IDC_COLNUM,EM_LIMITTEXT,80,0); - CenterDlgInParent(hwnd, NULL); + CenterDlgInParent(hwnd, NULL, false); } return true; @@ -8680,7 +8680,7 @@ static INT_PTR CALLBACK EditModifyLinesDlgProc(HWND hwnd, UINT umsg, WPARAM wPar SendDlgItemMessage(hwnd,IDC_MODLNS_ED_PREPEND, EM_LIMITTEXT, ENCLDATA_SIZE - 1, 0); SetDlgItemTextW(hwnd,IDC_MODLNS_ED_APPEND, pData->pwsz2); SendDlgItemMessage(hwnd,IDC_MODLNS_ED_APPEND, EM_LIMITTEXT, ENCLDATA_SIZE - 1, 0); - CenterDlgInParent(hwnd, NULL); + CenterDlgInParent(hwnd, NULL, false); } return true; @@ -8898,7 +8898,7 @@ static INT_PTR CALLBACK EditAlignDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARA } #endif CheckRadioButton(hwnd,100,104,*piAlignMode+100); - CenterDlgInParent(hwnd, NULL); + CenterDlgInParent(hwnd, NULL, false); } return true; @@ -9010,7 +9010,7 @@ static INT_PTR CALLBACK EditEncloseSelectionDlgProc(HWND hwnd, UINT umsg, WPARAM SetDlgItemTextW(hwnd, 100, pData->pwsz1); SendDlgItemMessage(hwnd, 101, EM_LIMITTEXT, ENCLDATA_SIZE - 1, 0); SetDlgItemTextW(hwnd, 101, pData->pwsz2); - CenterDlgInParent(hwnd, NULL); + CenterDlgInParent(hwnd, NULL, false); } return TRUE; @@ -9129,7 +9129,7 @@ static INT_PTR CALLBACK EditInsertTagDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,L SetDlgItemInt(hwnd, 102, pData->repeat, FALSE); SetFocus(GetDlgItem(hwnd,100)); PostMessageW(GetDlgItem(hwnd, 100), EM_SETSEL, 1, (LPARAM)(StringCchLen(pData->pwsz1, 0) - 1)); - CenterDlgInParent(hwnd, NULL); + CenterDlgInParent(hwnd, NULL, false); } return FALSE; @@ -9350,7 +9350,7 @@ static INT_PTR CALLBACK EditSortDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM *piSortFlags |= SORT_COLUMN; CheckDlgButton(hwnd,112,BST_CHECKED); } - CenterDlgInParent(hwnd, NULL); + CenterDlgInParent(hwnd, NULL, false); } return TRUE; diff --git a/src/Notepad3.c b/src/Notepad3.c index 036c20b4e..42b8fb2a5 100644 --- a/src/Notepad3.c +++ b/src/Notepad3.c @@ -5981,7 +5981,8 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam) case IDM_VIEW_WORDWRAP: Globals.fvCurFile.bWordWrap = Settings.WordWrap = !Settings.WordWrap; _SetWrapIndentMode(Globals.hwndEdit); - Sci_ScrollSelectionToView(); + //~Sci_ScrollSelectionToView(); // does not work here bug ? + SciCall_SetFirstVisibleLine(max_ln(0, Sci_GetCurrentLineNumber() - Settings2.CurrentLineVerticalSlop)); UpdateToolbar(); break; diff --git a/src/Styles.c b/src/Styles.c index ad24b8579..9ae66bbf0 100644 --- a/src/Styles.c +++ b/src/Styles.c @@ -4532,7 +4532,7 @@ INT_PTR CALLBACK Style_CustomizeSchemesDlgProc(HWND hwnd, UINT umsg, WPARAM wPar MakeBitmapButton(hwnd, IDC_NEXTSTYLE, IDB_NEXT, -1, -1); if (Settings.CustomSchemesDlgPosX == CW_USEDEFAULT || Settings.CustomSchemesDlgPosY == CW_USEDEFAULT) { - CenterDlgInParent(hwnd, NULL); + CenterDlgInParent(hwnd, NULL, false); } else { SetDlgPos(hwnd, Settings.CustomSchemesDlgPosX, Settings.CustomSchemesDlgPosY); } @@ -5107,7 +5107,7 @@ INT_PTR CALLBACK Style_CustomizeSchemesDlgProc(HWND hwnd, UINT umsg, WPARAM wPar break; case IDACC_RESETPOS: - CenterDlgInParent(hwnd, NULL); + CenterDlgInParent(hwnd, NULL, false); Settings.CustomSchemesDlgPosX = Settings.CustomSchemesDlgPosY = CW_USEDEFAULT; break; @@ -5225,7 +5225,7 @@ INT_PTR CALLBACK Style_SelectLexerDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPAR iInternalDefault = s_iDefaultLexer; CheckDlgButton(hwnd,IDC_AUTOSELECT, SetBtn(s_bAutoSelect)); - CenterDlgInParent(hwnd, NULL); + CenterDlgInParent(hwnd, NULL, false); } return TRUE; diff --git a/src/crypto/crypto.c b/src/crypto/crypto.c index 68ffcaaf3..df007033c 100644 --- a/src/crypto/crypto.c +++ b/src/crypto/crypto.c @@ -148,7 +148,7 @@ INT_PTR CALLBACK SetKeysDlgProc(HWND hDlg, UINT umsg, WPARAM wParam, LPARAM lPar CheckDlgButton(hDlg, IDC_PWD_CHECK3, SetBtn(hasMasterFileKey)); CheckDlgButton(hDlg, IDC_PWD_CHECK2, SetBtn(hasBinFileKey || useFileKey)); CheckDlgButton(hDlg, IDC_PWD_CHECK1, SetBtn(useMasterKey)); - CenterDlgInParent(hDlg, NULL); + CenterDlgInParent(hDlg, NULL, true); // Don't use: SetFocus( GetDlgItem( hDlg, IDC_PWD_EDIT1 ) ); SetDialogFocus(hDlg, GetDlgItem(hDlg, IDC_PWD_EDIT1)); } @@ -344,7 +344,7 @@ INT_PTR CALLBACK GetKeysDlgProc(HWND hDlg, UINT umsg, WPARAM wParam, LPARAM lPar //~SetDlgItemText( hDlg, IDC_PWD_EDIT3, fileKey ); SetDlgItemText(hDlg, IDC_PWD_EDIT3, unicodeFileKey); CheckDlgButton(hDlg, IDC_PWD_CHECK3, BST_UNCHECKED); - CenterDlgInParent(hDlg, NULL); + CenterDlgInParent(hDlg, NULL, true); // Don't use: SetFocus( GetDlgItem( hDlg, IDC_PWD_EDIT3 ) ); SetDialogFocus(hDlg, GetDlgItem(hDlg, IDC_PWD_EDIT3)); }