https://git.reactos.org/?p=reactos.git;a=commitdiff;h=62721aefe5ab79efedcff24693d0591d60a01d0c

commit 62721aefe5ab79efedcff24693d0591d60a01d0c
Author:     Eric Kohl <[email protected]>
AuthorDate: Mon Feb 10 09:47:59 2020 +0100
Commit:     Eric Kohl <[email protected]>
CommitDate: Mon Feb 10 09:48:37 2020 +0100

    [ACCESS] Select a property page by command line, for example 'control 
access.cpl,,2'
---
 dll/cpl/access/access.c | 20 ++++++++++++++------
 dll/cpl/access/access.h |  5 ++---
 2 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/dll/cpl/access/access.c b/dll/cpl/access/access.c
index 86a1f06907e..4f71945d6ef 100644
--- a/dll/cpl/access/access.c
+++ b/dll/cpl/access/access.c
@@ -13,9 +13,8 @@
 
 #define NUM_APPLETS    (1)
 
-LONG CALLBACK SystemApplet(VOID);
+static LONG CALLBACK SystemApplet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM 
lParam);
 HINSTANCE hApplet = 0;
-HWND hCPLWindow;
 
 /* Applets */
 APPLET Applets[NUM_APPLETS] =
@@ -185,14 +184,18 @@ PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam)
 /* First Applet */
 
 LONG CALLBACK
-SystemApplet(VOID)
+SystemApplet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam)
 {
     PGLOBAL_DATA pGlobalData;
     PROPSHEETPAGE psp[5];
     PROPSHEETHEADER psh;
     TCHAR Caption[1024];
+    INT nPage = 0;
     INT ret;
 
+    if (uMsg == CPL_STARTWPARMSW && lParam != 0)
+        nPage = _wtoi((PWSTR)lParam);
+
     LoadString(hApplet, IDS_CPLSYSTEMNAME, Caption, sizeof(Caption) / 
sizeof(TCHAR));
 
     pGlobalData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 
sizeof(GLOBAL_DATA));
@@ -208,7 +211,7 @@ SystemApplet(VOID)
     ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
     psh.dwSize = sizeof(PROPSHEETHEADER);
     psh.dwFlags =  PSH_PROPSHEETPAGE | PSH_USEICONID | PSH_USECALLBACK;
-    psh.hwndParent = hCPLWindow;
+    psh.hwndParent = hwnd;
     psh.hInstance = hApplet;
     psh.pszIcon = MAKEINTRESOURCEW(IDI_CPLACCESS);
     psh.pszCaption = Caption;
@@ -223,6 +226,9 @@ SystemApplet(VOID)
     InitPropSheetPage(&psp[3], IDD_PROPPAGEMOUSE, MousePageProc, pGlobalData);
     InitPropSheetPage(&psp[4], IDD_PROPPAGEGENERAL, GeneralPageProc, 
pGlobalData);
 
+    if (nPage != 0 && nPage <= psh.nPages)
+        psh.nStartPage = nPage;
+
     ret = PropertySheet(&psh);
 
     HeapFree(GetProcessHeap(), 0, pGlobalData);
@@ -258,9 +264,11 @@ CPlApplet(HWND hwndCPl,
             break;
 
         case CPL_DBLCLK:
-            hCPLWindow = hwndCPl;
-            Applets[i].AppletProc();
+            Applets[i].AppletProc(hwndCPl, uMsg, lParam1, lParam2);
             break;
+
+        case CPL_STARTWPARMSW:
+            return Applets[i].AppletProc(hwndCPl, uMsg, lParam1, lParam2);
     }
 
     return FALSE;
diff --git a/dll/cpl/access/access.h b/dll/cpl/access/access.h
index 0567616fcc1..d66f90850e2 100644
--- a/dll/cpl/access/access.h
+++ b/dll/cpl/access/access.h
@@ -10,17 +10,16 @@
 #include <winuser.h>
 #include <commctrl.h>
 #include <tchar.h>
+#include <cpl.h>
 
 #include "resource.h"
 
-typedef LONG (CALLBACK *APPLET_INITPROC)(VOID);
-
 typedef struct _APPLET
 {
     INT idIcon;
     INT idName;
     INT idDescription;
-    APPLET_INITPROC AppletProc;
+    APPLET_PROC AppletProc;
 } APPLET, *PAPPLET;
 
 

Reply via email to