Fixed color definition (bg and fg were swapped).
[wine] / programs / control / control.c
1 /* 
2  *   Control
3  *   Copyright (C) 1998 by Marcel Baur <mbaur@g26.ethz.ch>
4  *   To be distributed under the Wine license
5  */
6
7 #include <stdio.h>
8 #include <string.h>
9 #include <windows.h>
10 #include <shellapi.h>
11 #include "params.h"
12
13 void launch(char what[255])
14
15   HMODULE hMod;
16   FARPROC pControl_RunDLL;
17
18   hMod = LoadLibrary("shell32.dll");
19   pControl_RunDLL = GetProcAddress(hMod, "Control_RunDLL");
20   pControl_RunDLL(GetDesktopWindow(), 0, what, SW_SHOW);
21   FreeLibrary(hMod);
22   exit(0);
23 }
24
25 int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, CHAR *szParam, INT argc) 
26 {
27
28   char szParams[255];
29   lstrcpy(szParams, szParam);
30   CharUpper(szParams);
31
32   switch (argc) {
33     case 0:  /* no parameters - pop up whole "Control Panel" by default */
34              launch("");
35              break;
36
37     case 1:  /* check for optional parameter */
38              if (!strcmp(szParams,szP_DESKTOP))
39                  launch(szC_DESKTOP);
40              if (!strcmp(szParams,szP_COLOR))
41                  launch(szC_COLOR);
42              if (!strcmp(szParams,szP_DATETIME))
43                  launch(szC_DATETIME);
44              if (!strcmp(szParams,szP_DESKTOP))
45                  launch(szC_DESKTOP);
46              if (!strcmp(szParams,szP_INTERNATIONAL))
47                  launch(szC_INTERNATIONAL);
48              if (!strcmp(szParams,szP_KEYBOARD))
49                  launch(szC_KEYBOARD);
50              if (!strcmp(szParams,szP_MOUSE))
51                  launch(szC_MOUSE);
52              if (!strcmp(szParams,szP_PORTS))
53                  launch(szC_PORTS);
54              if (!strcmp(szParams,szP_PRINTERS))
55                  launch(szC_PRINTERS);
56
57              /* try to launch if a .cpl file is given directly */
58              launch(szParams);
59              break;
60
61     default: printf("Syntax error.");
62   }
63   return 0;  
64 }