From a88d7b5c2fe6d5ca903d529bb5343abe32e65ca8 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Sun, 15 Mar 2020 11:46:31 +0100 Subject: [PATCH] [DESK][CONTROL] Select property pages by command line, for example 'control desk.cpl,,1' and fix 'control color' --- base/applications/control/control.c | 2 +- dll/cpl/desk/desk.c | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/base/applications/control/control.c b/base/applications/control/control.c index ba3ceb2f45b..e08ed829b2f 100644 --- a/base/applications/control/control.c +++ b/base/applications/control/control.c @@ -86,7 +86,7 @@ wWinMain(HINSTANCE hInstance, /* Check one of the built-in control panel handlers */ if (!_wcsicmp(lpCmdLine, L"admintools")) return OpenShellFolder(L"\\::{D20EA4E1-3957-11d2-A40B-0C5020524153}"); - else if (!_wcsicmp(lpCmdLine, L"color")) return RunControlPanel(L"desk.cpl"); /* TODO: Switch to the "Apperance" tab */ + else if (!_wcsicmp(lpCmdLine, L"color")) return RunControlPanel(L"desk.cpl,,2"); else if (!_wcsicmp(lpCmdLine, L"date/time")) return RunControlPanel(L"timedate.cpl"); else if (!_wcsicmp(lpCmdLine, L"desktop")) return RunControlPanel(L"desk.cpl"); else if (!_wcsicmp(lpCmdLine, L"folders")) return RUNDLL(L"shell32.dll,Options_RunDLL"); diff --git a/dll/cpl/desk/desk.c b/dll/cpl/desk/desk.c index 28a296c1423..f2690aae5c5 100644 --- a/dll/cpl/desk/desk.c +++ b/dll/cpl/desk/desk.c @@ -150,6 +150,7 @@ DisplayApplet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam) LPCWSTR pwszSelectedTab = NULL; LPCWSTR pwszFile = NULL; LPCWSTR pwszAction = NULL; + INT nPage = 0; UNREFERENCED_PARAMETER(wParam); @@ -160,6 +161,8 @@ DisplayApplet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam) int argc; int i; + nPage = _wtoi((PWSTR)lParam); + #if 0 argv = CommandLineToArgvW((LPCWSTR)lParam, &argc); #else @@ -190,7 +193,7 @@ DisplayApplet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam) ActivateThemeFile(pwszFile); goto cleanup; } - + g_GlobalData.pwszFile = pwszFile; g_GlobalData.pwszAction = pwszAction; g_GlobalData.desktop_color = GetSysColor(COLOR_DESKTOP); @@ -232,6 +235,9 @@ DisplayApplet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam) /* NOTE: Don't call SHAddFromPropSheetExtArray here because this applet only allows replacing the background page but not extending the applet by more pages */ + if (nPage != 0 && psh.nStartPage == 0) + psh.nStartPage = nPage; + PropertySheet(&psh); cleanup: @@ -272,6 +278,7 @@ CPlApplet(HWND hwndCPl, UINT uMsg, LPARAM lParam1, LPARAM lParam2) case CPL_DBLCLK: Applets[i].AppletProc(hwndCPl, uMsg, lParam1, lParam2); break; + case CPL_STARTWPARMSW: return Applets[i].AppletProc(hwndCPl, uMsg, lParam1, lParam2); }