[DESK][CONTROL] Select property pages by command line, for example 'control desk.cpl,,1' and fix 'control color'

This commit is contained in:
Eric Kohl 2020-03-15 11:46:31 +01:00
parent 7a98d28d7f
commit a88d7b5c2f
2 changed files with 9 additions and 2 deletions

View file

@ -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");

View file

@ -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
@ -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);
}