shell32: RunFileDlg: use the parameters.
Implements the customizations that are required by the parameters. The icon and one flag are still not implemented.
This commit is contained in:
parent
0e2b5c7605
commit
225086547c
|
@ -53,7 +53,7 @@ typedef BOOL (*WINAPI LPFNOFN) (OPENFILENAMEW *) ;
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(shell);
|
WINE_DEFAULT_DEBUG_CHANNEL(shell);
|
||||||
static INT_PTR CALLBACK RunDlgProc (HWND, UINT, WPARAM, LPARAM) ;
|
static INT_PTR CALLBACK RunDlgProc (HWND, UINT, WPARAM, LPARAM) ;
|
||||||
static void FillList (HWND, char *) ;
|
static void FillList (HWND, char *, BOOL) ;
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
|
@ -116,17 +116,33 @@ void WINAPI RunFileDlgW(
|
||||||
/* Dialog procedure for RunFileDlg */
|
/* Dialog procedure for RunFileDlg */
|
||||||
static INT_PTR CALLBACK RunDlgProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
static INT_PTR CALLBACK RunDlgProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
static RUNFILEDLGPARAMS *prfdp = NULL ;
|
RUNFILEDLGPARAMS *prfdp = (RUNFILEDLGPARAMS *)GetWindowLongPtrW(hwnd, DWLP_USER);
|
||||||
|
|
||||||
switch (message)
|
switch (message)
|
||||||
{
|
{
|
||||||
case WM_INITDIALOG :
|
case WM_INITDIALOG :
|
||||||
prfdp = (RUNFILEDLGPARAMS *)lParam ;
|
prfdp = (RUNFILEDLGPARAMS *)lParam ;
|
||||||
SetWindowTextW (hwnd, prfdp->lpstrTitle) ;
|
SetWindowLongPtrW(hwnd, DWLP_USER, (LONG_PTR)prfdp);
|
||||||
|
|
||||||
|
if (prfdp->lpstrTitle)
|
||||||
|
SetWindowTextW(hwnd, prfdp->lpstrTitle);
|
||||||
|
if (prfdp->lpstrDescription)
|
||||||
|
SetWindowTextW(GetDlgItem(hwnd, IDC_RUNDLG_DESCRIPTION), prfdp->lpstrDescription);
|
||||||
|
if (prfdp->uFlags & RFF_NOBROWSE)
|
||||||
|
{
|
||||||
|
HWND browse = GetDlgItem(hwnd, IDC_RUNDLG_BROWSE);
|
||||||
|
ShowWindow(browse, SW_HIDE);
|
||||||
|
EnableWindow(browse, FALSE);
|
||||||
|
}
|
||||||
|
if (prfdp->uFlags & RFF_NOLABEL)
|
||||||
|
ShowWindow(GetDlgItem(hwnd, IDC_RUNDLG_LABEL), SW_HIDE);
|
||||||
|
if (prfdp->uFlags & RFF_CALCDIRECTORY)
|
||||||
|
FIXME("RFF_CALCDIRECTORY not supported\n");
|
||||||
|
|
||||||
SetClassLongPtrW (hwnd, GCLP_HICON, (LPARAM)prfdp->hIcon) ;
|
SetClassLongPtrW (hwnd, GCLP_HICON, (LPARAM)prfdp->hIcon) ;
|
||||||
SendMessageW (GetDlgItem (hwnd, 12297), STM_SETICON,
|
SendMessageW (GetDlgItem (hwnd, IDC_RUNDLG_ICON), STM_SETICON,
|
||||||
(WPARAM)LoadIconW (NULL, (LPCWSTR)IDI_WINLOGO), 0);
|
(WPARAM)LoadIconW (NULL, (LPCWSTR)IDI_WINLOGO), 0);
|
||||||
FillList (GetDlgItem (hwnd, IDC_RUNDLG_EDITPATH), NULL) ;
|
FillList (GetDlgItem (hwnd, IDC_RUNDLG_EDITPATH), NULL, (prfdp->uFlags & RFF_NODEFAULT) == 0) ;
|
||||||
SetFocus (GetDlgItem (hwnd, IDC_RUNDLG_EDITPATH)) ;
|
SetFocus (GetDlgItem (hwnd, IDC_RUNDLG_EDITPATH)) ;
|
||||||
return TRUE ;
|
return TRUE ;
|
||||||
|
|
||||||
|
@ -143,7 +159,10 @@ static INT_PTR CALLBACK RunDlgProc (HWND hwnd, UINT message, WPARAM wParam, LPAR
|
||||||
psz = HeapAlloc( GetProcessHeap(), 0, (ic + 1)*sizeof(WCHAR) );
|
psz = HeapAlloc( GetProcessHeap(), 0, (ic + 1)*sizeof(WCHAR) );
|
||||||
GetWindowTextW (htxt, psz, ic + 1) ;
|
GetWindowTextW (htxt, psz, ic + 1) ;
|
||||||
|
|
||||||
if (ShellExecuteW(NULL, NULL, psz, NULL, NULL, SW_SHOWNORMAL) < (HINSTANCE)33)
|
/* according to http://www.codeproject.com/KB/shell/runfiledlg.aspx we should send a
|
||||||
|
* WM_NOTIFY before execution */
|
||||||
|
|
||||||
|
if (ShellExecuteW(hwnd, NULL, psz, NULL, prfdp->lpstrDirectory, SW_SHOWNORMAL) < (HINSTANCE)33)
|
||||||
{
|
{
|
||||||
char *pszSysMsg = NULL ;
|
char *pszSysMsg = NULL ;
|
||||||
char szMsg[256];
|
char szMsg[256];
|
||||||
|
@ -166,7 +185,7 @@ static INT_PTR CALLBACK RunDlgProc (HWND hwnd, UINT message, WPARAM wParam, LPAR
|
||||||
|
|
||||||
/* FillList is still ANSI */
|
/* FillList is still ANSI */
|
||||||
GetWindowTextA (htxt, (LPSTR)psz, ic + 1) ;
|
GetWindowTextA (htxt, (LPSTR)psz, ic + 1) ;
|
||||||
FillList (htxt, (LPSTR)psz) ;
|
FillList (htxt, (LPSTR)psz, FALSE) ;
|
||||||
|
|
||||||
HeapFree(GetProcessHeap(), 0, psz);
|
HeapFree(GetProcessHeap(), 0, psz);
|
||||||
EndDialog (hwnd, 0) ;
|
EndDialog (hwnd, 0) ;
|
||||||
|
@ -197,6 +216,7 @@ static INT_PTR CALLBACK RunDlgProc (HWND hwnd, UINT message, WPARAM wParam, LPAR
|
||||||
ofn.nMaxFile = 1023;
|
ofn.nMaxFile = 1023;
|
||||||
ofn.lpstrTitle = szCaption;
|
ofn.lpstrTitle = szCaption;
|
||||||
ofn.Flags = OFN_ENABLESIZING | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_PATHMUSTEXIST;
|
ofn.Flags = OFN_ENABLESIZING | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_PATHMUSTEXIST;
|
||||||
|
ofn.lpstrInitialDir = prfdp->lpstrDirectory;
|
||||||
|
|
||||||
if (NULL == (hComdlg = LoadLibraryExW (comdlg32W, NULL, 0)) ||
|
if (NULL == (hComdlg = LoadLibraryExW (comdlg32W, NULL, 0)) ||
|
||||||
NULL == (ofnProc = (LPFNOFN)GetProcAddress (hComdlg, "GetOpenFileNameW")))
|
NULL == (ofnProc = (LPFNOFN)GetProcAddress (hComdlg, "GetOpenFileNameW")))
|
||||||
|
@ -209,8 +229,8 @@ static INT_PTR CALLBACK RunDlgProc (HWND hwnd, UINT message, WPARAM wParam, LPAR
|
||||||
if (ofnProc(&ofn))
|
if (ofnProc(&ofn))
|
||||||
{
|
{
|
||||||
SetFocus (GetDlgItem (hwnd, IDOK)) ;
|
SetFocus (GetDlgItem (hwnd, IDOK)) ;
|
||||||
SetWindowTextW (GetDlgItem (hwnd, 12298), szFName) ;
|
SetWindowTextW (GetDlgItem (hwnd, IDC_RUNDLG_EDITPATH), szFName) ;
|
||||||
SendMessageW (GetDlgItem (hwnd, 12298), CB_SETEDITSEL, 0, MAKELPARAM (0, -1)) ;
|
SendMessageW (GetDlgItem (hwnd, IDC_RUNDLG_EDITPATH), CB_SETEDITSEL, 0, MAKELPARAM (0, -1)) ;
|
||||||
SetFocus (GetDlgItem (hwnd, IDOK)) ;
|
SetFocus (GetDlgItem (hwnd, IDOK)) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -225,7 +245,8 @@ static INT_PTR CALLBACK RunDlgProc (HWND hwnd, UINT message, WPARAM wParam, LPAR
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This grabs the MRU list from the registry and fills the combo for the "Run" dialog above */
|
/* This grabs the MRU list from the registry and fills the combo for the "Run" dialog above */
|
||||||
static void FillList (HWND hCb, char *pszLatest)
|
/* fShowDefault ignored if pszLatest != NULL */
|
||||||
|
static void FillList (HWND hCb, char *pszLatest, BOOL fShowDefault)
|
||||||
{
|
{
|
||||||
HKEY hkey ;
|
HKEY hkey ;
|
||||||
/* char szDbgMsg[256] = "" ; */
|
/* char szDbgMsg[256] = "" ; */
|
||||||
|
@ -297,7 +318,7 @@ static void FillList (HWND hCb, char *pszLatest)
|
||||||
MessageBoxA (hCb, szDbgMsg, "Nix", MB_OK) ;
|
MessageBoxA (hCb, szDbgMsg, "Nix", MB_OK) ;
|
||||||
*/
|
*/
|
||||||
SendMessageA (hCb, CB_ADDSTRING, 0, (LPARAM)pszCmd) ;
|
SendMessageA (hCb, CB_ADDSTRING, 0, (LPARAM)pszCmd) ;
|
||||||
if (!Nix)
|
if (!Nix && fShowDefault)
|
||||||
{
|
{
|
||||||
SetWindowTextA (hCb, pszCmd) ;
|
SetWindowTextA (hCb, pszCmd) ;
|
||||||
SendMessageA (hCb, CB_SETEDITSEL, 0, MAKELPARAM (0, -1)) ;
|
SendMessageA (hCb, CB_SETEDITSEL, 0, MAKELPARAM (0, -1)) ;
|
||||||
|
@ -376,7 +397,11 @@ void WINAPI RunFileDlgA(
|
||||||
if (!MultiByteToWideChar(CP_ACP, 0, lpstrDirectory, -1, directory, MAX_PATH))
|
if (!MultiByteToWideChar(CP_ACP, 0, lpstrDirectory, -1, directory, MAX_PATH))
|
||||||
directory[0] = 0;
|
directory[0] = 0;
|
||||||
|
|
||||||
RunFileDlgW(hwndOwner, hIcon, directory, title, description, uFlags);
|
RunFileDlgW(hwndOwner, hIcon,
|
||||||
|
lpstrDirectory ? directory : NULL,
|
||||||
|
lpstrTitle ? title : NULL,
|
||||||
|
lpstrDescription ? description : NULL,
|
||||||
|
uFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
|
|
|
@ -156,9 +156,9 @@ STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
|
||||||
CAPTION ""
|
CAPTION ""
|
||||||
FONT 8, "MS Shell Dlg"
|
FONT 8, "MS Shell Dlg"
|
||||||
{
|
{
|
||||||
ICON "", 12297, 7, 11, 18, 20, WS_VISIBLE
|
ICON "", IDC_RUNDLG_ICON, 7, 11, 18, 20, WS_VISIBLE
|
||||||
LTEXT "Type the name of a program, folder, document, or Internet resource, and Wine will open it for you.", 12289, 36, 11, 182, 18
|
LTEXT "Type the name of a program, folder, document, or Internet resource, and Wine will open it for you.", IDC_RUNDLG_DESCRIPTION, 36, 11, 182, 18
|
||||||
LTEXT "&Open:", 12305, 7, 39, 24, 10
|
LTEXT "&Open:", IDC_RUNDLG_LABEL, 7, 39, 24, 10
|
||||||
CONTROL "", IDC_RUNDLG_EDITPATH, "COMBOBOX", WS_TABSTOP | WS_GROUP | WS_VSCROLL | WS_VISIBLE | CBS_DISABLENOSCROLL | CBS_AUTOHSCROLL | CBS_DROPDOWN, 36, 37, 183, 100
|
CONTROL "", IDC_RUNDLG_EDITPATH, "COMBOBOX", WS_TABSTOP | WS_GROUP | WS_VSCROLL | WS_VISIBLE | CBS_DISABLENOSCROLL | CBS_AUTOHSCROLL | CBS_DROPDOWN, 36, 37, 183, 100
|
||||||
DEFPUSHBUTTON "OK", IDOK, 62, 63, 50, 14, WS_TABSTOP
|
DEFPUSHBUTTON "OK", IDOK, 62, 63, 50, 14, WS_TABSTOP
|
||||||
PUSHBUTTON "Cancel", IDCANCEL, 116, 63, 50, 14, WS_TABSTOP
|
PUSHBUTTON "Cancel", IDCANCEL, 116, 63, 50, 14, WS_TABSTOP
|
||||||
|
|
|
@ -178,7 +178,10 @@ FIXME: Need to add them, but for now just let them use the same: searching.avi
|
||||||
#define IDC_ABOUT_STATIC_TEXT3 102
|
#define IDC_ABOUT_STATIC_TEXT3 102
|
||||||
|
|
||||||
/* run dialog */
|
/* run dialog */
|
||||||
|
#define IDC_RUNDLG_DESCRIPTION 12289
|
||||||
#define IDC_RUNDLG_BROWSE 12288
|
#define IDC_RUNDLG_BROWSE 12288
|
||||||
|
#define IDC_RUNDLG_ICON 12297
|
||||||
#define IDC_RUNDLG_EDITPATH 12298
|
#define IDC_RUNDLG_EDITPATH 12298
|
||||||
|
#define IDC_RUNDLG_LABEL 12305
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue