Mikołaj Zalewski : shell32: RunFileDlg: allow the user to cancel the Browse dialog, remove some unneeded parameters.
Alexandre Julliard
julliard at winehq.org
Mon Jun 30 08:27:04 CDT 2008
Module: wine
Branch: master
Commit: ebb41a64ab2775d7fcb5baf79e29f97183ae4574
URL: http://source.winehq.org/git/wine.git/?a=commit;h=ebb41a64ab2775d7fcb5baf79e29f97183ae4574
Author: Mikołaj Zalewski <mikolaj at zalewski.pl>
Date: Fri Jun 27 17:45:10 2008 +0200
shell32: RunFileDlg: allow the user to cancel the Browse dialog, remove some unneeded parameters.
---
dlls/shell32/dialogs.c | 47 +++++++++++++++++------------------------------
1 files changed, 17 insertions(+), 30 deletions(-)
diff --git a/dlls/shell32/dialogs.c b/dlls/shell32/dialogs.c
index 034768f..4359289 100644
--- a/dlls/shell32/dialogs.c
+++ b/dlls/shell32/dialogs.c
@@ -184,36 +184,21 @@ static INT_PTR CALLBACK RunDlgProc (HWND hwnd, UINT message, WPARAM wParam, LPAR
{
HMODULE hComdlg = NULL ;
LPFNOFN ofnProc = NULL ;
- WCHAR szFName[1024] = {0}, szFileTitle[256] = {0}, szInitDir[768] = {0} ;
+ WCHAR szFName[1024] = {0};
WCHAR szFilter[MAX_PATH], szCaption[MAX_PATH];
static const char ansiFilter[] = "Executable Files\0*.exe\0All Files\0*.*\0\0\0\0";
- OPENFILENAMEW ofn =
- {
- sizeof (OPENFILENAMEW),
- NULL,
- NULL,
- szFilter,
- NULL,
- 0,
- 0,
- szFName,
- 1023,
- szFileTitle,
- 255,
- szInitDir,
- szCaption,
- OFN_ENABLESIZING | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_PATHMUSTEXIST,
- 0,
- 0,
- NULL,
- 0,
- (LPOFNHOOKPROC)NULL,
- NULL
- } ;
+ OPENFILENAMEW ofn;
MultiByteToWideChar(CP_UTF8, 0, ansiFilter, sizeof(ansiFilter), szFilter, MAX_PATH);
MultiByteToWideChar(CP_UTF8, 0, "Browse", -1, szCaption, MAX_PATH);
- ofn.hwndOwner = hwnd ;
+ ZeroMemory(&ofn, sizeof(ofn));
+ ofn.lStructSize = sizeof(OPENFILENAMEW);
+ ofn.hwndOwner = hwnd;
+ ofn.lpstrFilter = szFilter;
+ ofn.lpstrFile = szFName;
+ ofn.nMaxFile = 1023;
+ ofn.lpstrTitle = szCaption;
+ ofn.Flags = OFN_ENABLESIZING | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_PATHMUSTEXIST;
if (NULL == (hComdlg = LoadLibraryExA ("comdlg32", NULL, 0)))
{
@@ -227,12 +212,14 @@ static INT_PTR CALLBACK RunDlgProc (HWND hwnd, UINT message, WPARAM wParam, LPAR
return TRUE ;
}
- ofnProc (&ofn) ;
+ if (ofnProc(&ofn))
+ {
- SetFocus (GetDlgItem (hwnd, IDOK)) ;
- SetWindowTextW (GetDlgItem (hwnd, 12298), szFName) ;
- SendMessageW (GetDlgItem (hwnd, 12298), CB_SETEDITSEL, 0, MAKELPARAM (0, -1)) ;
- SetFocus (GetDlgItem (hwnd, IDOK)) ;
+ SetFocus (GetDlgItem (hwnd, IDOK)) ;
+ SetWindowTextW (GetDlgItem (hwnd, 12298), szFName) ;
+ SendMessageW (GetDlgItem (hwnd, 12298), CB_SETEDITSEL, 0, MAKELPARAM (0, -1)) ;
+ SetFocus (GetDlgItem (hwnd, IDOK)) ;
+ }
FreeLibrary (hComdlg) ;
More information about the wine-cvs
mailing list