Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
wine-mirror
GitHub Repository: wine-mirror/wine
Path: blob/master/programs/control/control.c
4389 views
1
/*
2
* Start a control panel applet or open the control panel window
3
*
4
* Copyright (C) 1998 by Marcel Baur <[email protected]>
5
* Copyright 2010 Detlef Riekenberg
6
*
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.
11
*
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.
16
*
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
20
*/
21
22
#define WIN32_LEAN_AND_MEAN
23
24
#include <stdio.h>
25
#include <string.h>
26
#include <windows.h>
27
#include <commctrl.h>
28
#include <shellapi.h>
29
30
31
extern void WINAPI Control_RunDLLW(HWND hWnd, HINSTANCE hInst, LPCWSTR cmd, DWORD nCmdShow);
32
33
static void launch(LPCWSTR what)
34
{
35
Control_RunDLLW(GetDesktopWindow(), 0, what, SW_SHOW);
36
ExitProcess(0);
37
}
38
39
int WINAPI wWinMain(HINSTANCE hInst, HINSTANCE hPrev, LPWSTR lpszCmdLine, INT nCmdShow)
40
{
41
InitCommonControls();
42
43
/* no parameters - pop up whole "Control Panel" by default */
44
if (!*lpszCmdLine) {
45
launch(lpszCmdLine);
46
}
47
48
/* check for optional parameter */
49
if (!lstrcmpiW(lpszCmdLine, L"COLOR"))
50
launch(L"desk.cpl,,2");
51
if (!lstrcmpiW(lpszCmdLine, L"DATE/TIME"))
52
launch(L"timedate.cpl");
53
if (!lstrcmpiW(lpszCmdLine, L"DESKTOP"))
54
launch(L"desk.cpl");
55
if (!lstrcmpiW(lpszCmdLine, L"INTERNATIONAL"))
56
launch(L"intl.cpl");
57
if (!lstrcmpiW(lpszCmdLine, L"KEYBOARD"))
58
launch(L"main.cpl @1");
59
if (!lstrcmpiW(lpszCmdLine, L"MOUSE"))
60
launch(L"main.cpl");
61
if (!lstrcmpiW(lpszCmdLine, L"PORTS"))
62
launch(L"sysdm.cpl,,1");
63
if (!lstrcmpiW(lpszCmdLine, L"PRINTERS"))
64
launch(L"main.cpl @2");
65
66
/* try to launch if a .cpl file is given directly */
67
launch(lpszCmdLine);
68
return 0;
69
}
70
71