Cast time_t to long for printing.
[wine] / programs / control / control.c
1 /*
2  *   Control
3  *   Copyright (C) 1998 by Marcel Baur <mbaur@g26.ethz.ch>
4  *
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.
9  *
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.
14  *
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
18  */
19
20 #include <stdio.h>
21 #include <string.h>
22 #include <windows.h>
23 #include <shellapi.h>
24 #include "params.h"
25
26 extern void WINAPI Control_RunDLL(HWND hWnd, HINSTANCE hInst, LPCSTR cmd, DWORD nCmdShow);
27 void launch(const char *what)
28 {
29   Control_RunDLL(GetDesktopWindow(), 0, what, SW_SHOW);
30   exit(0);
31 }
32
33 int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpszCmdLine, INT nCmdShow)
34 {
35     char szParams[255];
36     lstrcpy(szParams, lpszCmdLine);
37     CharUpper(szParams);
38
39     /* no parameters - pop up whole "Control Panel" by default */
40     if (!*szParams) {
41         launch("");
42         return 0;
43     }
44
45     /* check for optional parameter */
46     if (!strcmp(szParams,szP_DESKTOP))
47         launch(szC_DESKTOP);
48     if (!strcmp(szParams,szP_COLOR))
49         launch(szC_COLOR);
50     if (!strcmp(szParams,szP_DATETIME))
51         launch(szC_DATETIME);
52     if (!strcmp(szParams,szP_DESKTOP))
53         launch(szC_DESKTOP);
54     if (!strcmp(szParams,szP_INTERNATIONAL))
55         launch(szC_INTERNATIONAL);
56     if (!strcmp(szParams,szP_KEYBOARD))
57         launch(szC_KEYBOARD);
58     if (!strcmp(szParams,szP_MOUSE))
59         launch(szC_MOUSE);
60     if (!strcmp(szParams,szP_PORTS))
61         launch(szC_PORTS);
62     if (!strcmp(szParams,szP_PRINTERS))
63         launch(szC_PRINTERS);
64
65     /* try to launch if a .cpl file is given directly */
66     launch(szParams);
67     return 0;
68 }