Index: dll/win32/shell32/dialogs/dialogs.cpp =================================================================== --- dll/win32/shell32/dialogs/dialogs.cpp (revision 69749) +++ dll/win32/shell32/dialogs/dialogs.cpp (working copy) @@ -346,6 +346,27 @@ } } +static void EnableOkButtonFromEditContents(HWND hwnd) +{ + BOOL Enable = FALSE; + INT Length, n; + HWND Edit = GetDlgItem(hwnd, IDC_RUNDLG_EDITPATH); + Length = GetWindowTextLengthA(Edit); + if (Length > 0) + { + PWCHAR psz = (PWCHAR)HeapAlloc(GetProcessHeap(), 0, (Length + 1)*sizeof(WCHAR)); + if (psz) + { + GetWindowTextW(Edit, psz, Length + 1); + for (n = 0; n < Length && !Enable; ++n) + Enable = psz[n] != ' '; + HeapFree(GetProcessHeap(), 0, psz); + } + else + Enable = TRUE; + } + EnableWindow (GetDlgItem(hwnd, IDOK), Enable); +} /* Dialog procedure for RunFileDlg */ static INT_PTR CALLBACK RunDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) @@ -379,6 +400,7 @@ SendMessageW(hwnd, WM_SETICON, ICON_SMALL, (LPARAM)prfdp->hIcon); FillList (GetDlgItem (hwnd, IDC_RUNDLG_EDITPATH), NULL, (prfdp->uFlags & RFF_NODEFAULT) == 0); + EnableOkButtonFromEditContents(hwnd); SetFocus (GetDlgItem (hwnd, IDC_RUNDLG_EDITPATH)); return TRUE; @@ -472,6 +494,7 @@ SetFocus (GetDlgItem (hwnd, IDOK)); SetWindowTextW (GetDlgItem (hwnd, IDC_RUNDLG_EDITPATH), szFName); SendMessageW (GetDlgItem (hwnd, IDC_RUNDLG_EDITPATH), CB_SETEDITSEL, 0, MAKELPARAM (0, -1)); + EnableOkButtonFromEditContents(hwnd); SetFocus (GetDlgItem (hwnd, IDOK)); } @@ -479,6 +502,14 @@ return TRUE; } + case IDC_RUNDLG_EDITPATH: + { + if (HIWORD(wParam) == CBN_EDITCHANGE) + { + EnableOkButtonFromEditContents(hwnd); + } + return TRUE; + } } return TRUE; }