https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5ea8314e671be2367147c…
commit 5ea8314e671be2367147cf787d2e7a61c2306cac
Author: Eric Kohl <eric.kohl(a)reactos.org>
AuthorDate: Sat Mar 14 18:03:52 2020 +0100
Commit: Eric Kohl <eric.kohl(a)reactos.org>
CommitDate: Sat Mar 14 18:03:52 2020 +0100
[MAIN] Select property pages by command line, for example 'control
main.cpl,@0,2'
---
dll/cpl/main/keyboard.c | 7 +++++++
dll/cpl/main/main.c | 3 +++
dll/cpl/main/mouse.c | 7 +++++++
3 files changed, 17 insertions(+)
diff --git a/dll/cpl/main/keyboard.c b/dll/cpl/main/keyboard.c
index 5cf39b89bc9..29e839bbc5c 100644
--- a/dll/cpl/main/keyboard.c
+++ b/dll/cpl/main/keyboard.c
@@ -306,6 +306,7 @@ KeyboardApplet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam)
PROPSHEETHEADER psh;
HPSXA hpsxa;
TCHAR szCaption[256];
+ INT nPage = 0;
LONG ret;
UNREFERENCED_PARAMETER(lParam);
@@ -313,6 +314,9 @@ KeyboardApplet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam)
UNREFERENCED_PARAMETER(uMsg);
UNREFERENCED_PARAMETER(hwnd);
+ if (uMsg == CPL_STARTWPARMSW && lParam != 0)
+ nPage = _wtoi((PWSTR)lParam);
+
LoadString(hApplet, IDS_CPLNAME_2, szCaption, sizeof(szCaption) / sizeof(TCHAR));
ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
@@ -337,6 +341,9 @@ KeyboardApplet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam)
if (hpsxa != NULL)
SHAddFromPropSheetExtArray(hpsxa, PropSheetAddPage, (LPARAM)&psh);
+ if (nPage != 0 && nPage <= psh.nPages)
+ psh.nStartPage = nPage;
+
ret = (LONG)(PropertySheet(&psh) != -1);
if (hpsxa != NULL)
diff --git a/dll/cpl/main/main.c b/dll/cpl/main/main.c
index 272aafc52b4..6e1294b3bd0 100644
--- a/dll/cpl/main/main.c
+++ b/dll/cpl/main/main.c
@@ -113,6 +113,9 @@ CPlApplet(HWND hwndCpl,
Applets[uAppIndex].AppletProc(hwndCpl, uMsg, lParam1, lParam2);
break;
}
+
+ case CPL_STARTWPARMSW:
+ return Applets[(UINT)lParam1].AppletProc(hwndCpl, uMsg, lParam1, lParam2);
}
return FALSE;
diff --git a/dll/cpl/main/mouse.c b/dll/cpl/main/mouse.c
index 4614e6ebc1f..89d4bbbdeb4 100644
--- a/dll/cpl/main/mouse.c
+++ b/dll/cpl/main/mouse.c
@@ -1833,6 +1833,7 @@ MouseApplet(HWND hwnd, UINT uMsg, LPARAM lParam1, LPARAM lParam2)
HPSXA hpsxa;
TCHAR Caption[256];
UINT i;
+ INT nPage = 0;
LONG ret;
UNREFERENCED_PARAMETER(lParam1);
@@ -1840,6 +1841,9 @@ MouseApplet(HWND hwnd, UINT uMsg, LPARAM lParam1, LPARAM lParam2)
UNREFERENCED_PARAMETER(uMsg);
UNREFERENCED_PARAMETER(hwnd);
+ if (uMsg == CPL_STARTWPARMSW && lParam2 != 0)
+ nPage = _wtoi((PWSTR)lParam2);
+
LoadString(hApplet, IDS_CPLNAME_1, Caption, sizeof(Caption) / sizeof(TCHAR));
ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
@@ -1873,6 +1877,9 @@ MouseApplet(HWND hwnd, UINT uMsg, LPARAM lParam1, LPARAM lParam2)
if (hpsxa != NULL)
SHAddFromPropSheetExtArray(hpsxa, PropSheetAddPage, (LPARAM)&psh);
+ if (nPage != 0 && nPage <= psh.nPages)
+ psh.nStartPage = nPage;
+
ret = (LONG)(PropertySheet(&psh) != -1);
if (hpsxa != NULL)