mirror of
https://github.com/reactos/reactos.git
synced 2025-04-25 16:10:29 +00:00
[SHELL32] Handle the Progman Folder options message and tab switching support (#5574)
* Handle the "OnShowOptionsDlg" message * Support switching tabs * Update dll/win32/shell32/dialogs/folder_options.cpp * Update dll/win32/shell32/shelldesktop/CDesktopBrowser.cpp * ShowFolderOptionsDialog workaround * Added Vista pages, define for magic message --------- Co-authored-by: Stanislav Motylkov <x86corez@gmail.com> Co-authored-by: Thamatip Chitpong <weedgamer131@gmail.com>
This commit is contained in:
parent
5b82ada2ed
commit
8841e3d7ba
4 changed files with 84 additions and 9 deletions
|
@ -274,3 +274,11 @@ LPVOID *ppv)
|
|||
|
||||
return ShellObjectCreatorInit<CRShellClassFactory>(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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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<CMSGlobalFolderOptionsStub>
|
||||
{
|
||||
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:
|
||||
|
|
|
@ -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<CDesktopBrowser, IShellDesktopTray*>(Tray, riid, ppv);
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue