diff --git a/base/shell/rshell/misc.cpp b/base/shell/rshell/misc.cpp index d17619bf076..ee9fb672aa1 100644 --- a/base/shell/rshell/misc.cpp +++ b/base/shell/rshell/misc.cpp @@ -274,3 +274,11 @@ LPVOID *ppv) return ShellObjectCreatorInit(rclsid, riid, ppv); } + +VOID WINAPI ShowFolderOptionsDialog(UINT Page, BOOL Async) +{ + char buf[MAX_PATH]; + wsprintfA(buf, "rundll32.exe shell32.dll,Options_RunDLL %u", Page); + WinExec(buf, SW_SHOW); +} + diff --git a/dll/win32/shell32/dialogs/folder_options.cpp b/dll/win32/shell32/dialogs/folder_options.cpp index ea0e4ed4b4b..1db02c87edb 100644 --- a/dll/win32/shell32/dialogs/folder_options.cpp +++ b/dll/win32/shell32/dialogs/folder_options.cpp @@ -192,10 +192,13 @@ HBITMAP CreateRadioMask(HDC hDC) // CMSGlobalFolderOptionsStub --- The owner window of Folder Options. // This window hides taskbar button of Folder Options. + +#define GlobalFolderOptionsClassName _T("MSGlobalFolderOptionsStub") + class CMSGlobalFolderOptionsStub : public CWindowImpl { public: - DECLARE_WND_CLASS_EX(_T("MSGlobalFolderOptionsStub"), 0, COLOR_WINDOWTEXT) + DECLARE_WND_CLASS_EX(GlobalFolderOptionsClassName, 0, COLOR_WINDOWTEXT) BEGIN_MSG_MAP(CMSGlobalFolderOptionsStub) END_MSG_MAP() @@ -222,8 +225,14 @@ PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam) return 0; } -static VOID -ShowFolderOptionsDialog(HWND hWnd, HINSTANCE hInst) +enum { + PAGE_GENERAL, + PAGE_VIEW, + PAGE_FILETYPES +}; + +static DWORD CALLBACK +ShowFolderOptionsDialogThreadProc(LPVOID param) { PROPSHEETHEADERW pinfo; HPROPSHEETPAGE hppages[3]; @@ -254,7 +263,7 @@ ShowFolderOptionsDialog(HWND hWnd, HINSTANCE hInst) if (!stub.Create(NULL, NULL, NULL, style, exstyle)) { ERR("stub.Create failed\n"); - return; + return 0; } memset(&pinfo, 0x0, sizeof(PROPSHEETHEADERW)); @@ -266,10 +275,34 @@ ShowFolderOptionsDialog(HWND hWnd, HINSTANCE hInst) pinfo.pszIcon = MAKEINTRESOURCEW(IDI_SHELL_FOLDER_OPTIONS); pinfo.pszCaption = szOptions; pinfo.pfnCallback = PropSheetProc; + pinfo.nStartPage = PtrToUlong(param); PropertySheetW(&pinfo); stub.DestroyWindow(); + return 0; +} + +VOID WINAPI +ShowFolderOptionsDialog(UINT Page, BOOL Async = FALSE) +{ + HWND hWnd = FindWindow(GlobalFolderOptionsClassName, NULL); + if (hWnd) + { + HWND hPop = GetLastActivePopup(hWnd); + if (hWnd == GetParent(hPop)) + { + PostMessage(hPop, PSM_SETCURSEL, Page, 0); + } + SetForegroundWindow(hPop); + return; + } + + LPVOID param = UlongToPtr(Page); + if (Async) + SHCreateThread(ShowFolderOptionsDialogThreadProc, param, 0, 0); + else + ShowFolderOptionsDialogThreadProc(param); // Rundll32 caller cannot be async! } static VOID @@ -278,13 +311,20 @@ Options_RunDLLCommon(HWND hWnd, HINSTANCE hInst, int fOptions, DWORD nCmdShow) switch(fOptions) { case 0: - ShowFolderOptionsDialog(hWnd, hInst); + ShowFolderOptionsDialog(PAGE_GENERAL); break; - case 1: - // show taskbar options dialog - FIXME("notify explorer to show taskbar options dlg\n"); - //PostMessage(GetShellWindow(), WM_USER+22, fOptions, 0); + case 1: // Taskbar settings +#if (NTDDI_VERSION >= NTDDI_VISTA) + case 3: // Start menu settings + case 4: // Tray icon settings + case 6: // Taskbar toolbars +#endif + PostMessage(GetShellWindow(), WM_PROGMAN_OPENSHELLSETTINGS, fOptions, 0); + break; + + case 7: // Windows 8, 10 + ShowFolderOptionsDialog(PAGE_VIEW); break; default: diff --git a/dll/win32/shell32/shelldesktop/CDesktopBrowser.cpp b/dll/win32/shell32/shelldesktop/CDesktopBrowser.cpp index 6e1d63b7ef4..e5e53441dd1 100644 --- a/dll/win32/shell32/shelldesktop/CDesktopBrowser.cpp +++ b/dll/win32/shell32/shelldesktop/CDesktopBrowser.cpp @@ -85,6 +85,7 @@ public: LRESULT OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); LRESULT OnSetFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); LRESULT OnGetChangeNotifyServer(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); + LRESULT OnShowOptionsDlg(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); DECLARE_WND_CLASS_EX(szProgmanClassName, CS_DBLCLKS, COLOR_DESKTOP) @@ -98,6 +99,7 @@ BEGIN_MSG_MAP(CBaseBar) MESSAGE_HANDLER(WM_COMMAND, OnCommand) MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus) MESSAGE_HANDLER(WM_DESKTOP_GET_CNOTIFY_SERVER, OnGetChangeNotifyServer) + MESSAGE_HANDLER(WM_PROGMAN_OPENSHELLSETTINGS, OnShowOptionsDlg) END_MSG_MAP() BEGIN_COM_MAP(CDesktopBrowser) @@ -458,6 +460,26 @@ LRESULT CDesktopBrowser::OnGetChangeNotifyServer(UINT uMsg, WPARAM wParam, LPARA return (LRESULT)m_hwndChangeNotifyServer; } +extern VOID WINAPI ShowFolderOptionsDialog(UINT Page, BOOL Async); + +LRESULT CDesktopBrowser::OnShowOptionsDlg(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled) +{ + switch (wParam) + { + case 0: +#if (NTDDI_VERSION >= NTDDI_VISTA) + case 2: + case 7: +#endif + ShowFolderOptionsDialog((UINT)(UINT_PTR)wParam, TRUE); + break; + case 1: + _NotifyTray(WM_COMMAND, TRAYCMD_TASKBAR_PROPERTIES, 0); + break; + } + return 0; +} + HRESULT CDesktopBrowser_CreateInstance(IShellDesktopTray *Tray, REFIID riid, void **ppv) { return ShellObjectCreatorInit(Tray, riid, ppv); diff --git a/sdk/include/reactos/undocshell.h b/sdk/include/reactos/undocshell.h index 2c79315bcca..bb216df8ad8 100644 --- a/sdk/include/reactos/undocshell.h +++ b/sdk/include/reactos/undocshell.h @@ -54,6 +54,11 @@ typedef struct _TRAYNOTIFYDATAW #define TWM_DOEXITWINDOWS (WM_USER + 342) #define TWM_CYCLEFOCUS (WM_USER + 348) +/**************************************************************************** + * ProgMan messages + */ +#define WM_PROGMAN_OPENSHELLSETTINGS (WM_USER + 22) /* wParam specifies the dialog (and tab page) */ + /**************************************************************************** * IDList Functions */