3 * Copyright (C) 1998 by Marcel Baur <mbaur@g26.ethz.ch>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 * Portions copyright Robert Dickenson <robd@reactos.org>, August 15, 2002.
23 #define WIN32_LEAN_AND_MEAN
29 //typedef void (WINAPI *CONTROL_RUNDLL)(HWND hWnd, HINSTANCE hInst, LPCTSTR cmd, DWORD nCmdShow);
30 typedef void (*CONTROL_RUNDLL
)(HWND hWnd
, HINSTANCE hInst
, LPCTSTR cmd
, DWORD nCmdShow
);
32 const TCHAR szLibName
[] = _T("ROSHEL32.DLL");
34 const char szProcName
[] = "Control_RunDLLW";
36 const char szProcName
[] = "Control_RunDLLA";
41 extern void __declspec(dllimport
) Control_RunDLLW(HWND hWnd
, HINSTANCE hInst
, LPCWSTR cmd
, DWORD nCmdShow
);
43 extern void __declspec(dllimport
) Control_RunDLLA(HWND hWnd
, HINSTANCE hInst
, LPCSTR cmd
, DWORD nCmdShow
);
48 #define Control_RunDLL Control_RunDLLW
50 #define Control_RunDLL Control_RunDLLA
54 void launch(LPTSTR lpCmdLine
)
58 CONTROL_RUNDLL pControl_RunDLL
;
60 hShell32
= LoadLibrary(szLibName
);
62 pControl_RunDLL
= (CONTROL_RUNDLL
)(FARPROC
)GetProcAddress(hShell32
, szProcName
);
63 if (pControl_RunDLL
) {
64 pControl_RunDLL(GetDesktopWindow(), 0, lpCmdLine
, SW_SHOW
);
66 _tprintf(_T("ERROR: failed to Get Procedure Address for %s in Library %s\n"), szLibName
, szProcName
);
68 FreeLibrary(hShell32
);
70 _tprintf(_T("ERROR: failed to Load Library %s\n"), szLibName
);
73 Control_RunDLL(GetDesktopWindow(), 0, lpCmdLine
, SW_SHOW
);
78 int WINAPI
WinMain(HINSTANCE hInst
, HINSTANCE hPrev
, CHAR
*szParam
, INT argc
)
81 LPTSTR pParams
= GetCommandLine();
82 lstrcpy(szParams
, pParams
);
85 _tprintf(_T("Control Panel Launcher...\n"));
88 case 0: /* no parameters - pop up whole "Control Panel" by default */
91 case 1: /* check for optional parameter */
92 if (!lstrcmp(szParams
,szP_DESKTOP
))
94 if (!lstrcmp(szParams
,szP_COLOR
))
96 if (!lstrcmp(szParams
,szP_DATETIME
))
98 if (!lstrcmp(szParams
,szP_DESKTOP
))
100 if (!lstrcmp(szParams
,szP_INTERNATIONAL
))
101 launch(szC_INTERNATIONAL
);
102 if (!lstrcmp(szParams
,szP_KEYBOARD
))
103 launch(szC_KEYBOARD
);
104 if (!lstrcmp(szParams
,szP_MOUSE
))
106 if (!lstrcmp(szParams
,szP_PORTS
))
108 if (!lstrcmp(szParams
,szP_PRINTERS
))
109 launch(szC_PRINTERS
);
110 /* try to launch if a .cpl file is given directly */
113 default: _tprintf(_T("Syntax error."));