comctl32/tests: Extend TVS_SINGLEEXPAND tests.
[wine.git] / programs / control / control.c
blob9f9005f748850b73e9a67a21515185c055a9c36b
1 /*
2 * Start a control panel applet or open the control panel window
4 * Copyright (C) 1998 by Marcel Baur <mbaur@g26.ethz.ch>
5 * Copyright 2010 Detlef Riekenberg
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #define WIN32_LEAN_AND_MEAN
24 #include <stdio.h>
25 #include <string.h>
26 #include <windows.h>
27 #include <shellapi.h>
29 /* alphabetical list of recognized optional command line parameters */
30 static const WCHAR szP_COLOR[] = {'C','O','L','O','R',0};
31 static const WCHAR szP_DATETIME[] = {'D','A','T','E','/','T','I','M','E',0};
32 static const WCHAR szP_DESKTOP[] = {'D','E','S','K','T','O','P',0};
33 static const WCHAR szP_INTERNATIONAL[] = {'I','N','T','E','R','N','A','T','I','O','N','A','L',0};
34 static const WCHAR szP_KEYBOARD[] = {'K','E','Y','B','O','A','R','D',0};
35 static const WCHAR szP_MOUSE[] = {'M','O','U','S','E',0};
36 static const WCHAR szP_PORTS[] = {'P','O','R','T','S',0};
37 static const WCHAR szP_PRINTERS [] = {'P','R','I','N','T','E','R','S',0};
39 /* alphabetical list of appropriate commands to execute */
40 static const WCHAR szC_COLOR[] = {'d','e','s','k','.','c','p','l',',',',','2',0};
41 static const WCHAR szC_DATETIME[] = {'t','i','m','e','d','a','t','e','.','c','p','l',0};
42 static const WCHAR szC_DESKTOP[] = {'d','e','s','k','.','c','p','l',0};
43 static const WCHAR szC_INTERNATIONAL[] = {'i','n','t','l','.','c','p','l',0};
44 static const WCHAR szC_KEYBOARD[] = {'m','a','i','n','.','c','p','l',' ','@','1',0};
45 static const WCHAR szC_MOUSE[] = {'m','a','i','n','.','c','p','l',0};
46 static const WCHAR szC_PORTS[] = {'s','y','s','d','m','.','c','p','l',',',',','1',0};
47 static const WCHAR szC_PRINTERS[] = {'m','a','i','n','.','c','p','l',' ','@','2',0};
50 extern void WINAPI Control_RunDLLW(HWND hWnd, HINSTANCE hInst, LPCWSTR cmd, DWORD nCmdShow);
52 static void launch(LPCWSTR what)
54 Control_RunDLLW(GetDesktopWindow(), 0, what, SW_SHOW);
55 ExitProcess(0);
58 int WINAPI wWinMain(HINSTANCE hInst, HINSTANCE hPrev, LPWSTR lpszCmdLine, INT nCmdShow)
60 /* no parameters - pop up whole "Control Panel" by default */
61 if (!*lpszCmdLine) {
62 launch(lpszCmdLine);
65 /* check for optional parameter */
66 if (!lstrcmpiW(lpszCmdLine,szP_COLOR))
67 launch(szC_COLOR);
68 if (!lstrcmpiW(lpszCmdLine,szP_DATETIME))
69 launch(szC_DATETIME);
70 if (!lstrcmpiW(lpszCmdLine,szP_DESKTOP))
71 launch(szC_DESKTOP);
72 if (!lstrcmpiW(lpszCmdLine,szP_INTERNATIONAL))
73 launch(szC_INTERNATIONAL);
74 if (!lstrcmpiW(lpszCmdLine,szP_KEYBOARD))
75 launch(szC_KEYBOARD);
76 if (!lstrcmpiW(lpszCmdLine,szP_MOUSE))
77 launch(szC_MOUSE);
78 if (!lstrcmpiW(lpszCmdLine,szP_PORTS))
79 launch(szC_PORTS);
80 if (!lstrcmpiW(lpszCmdLine,szP_PRINTERS))
81 launch(szC_PRINTERS);
83 /* try to launch if a .cpl file is given directly */
84 launch(lpszCmdLine);
85 return 0;