display the hardware tab
[reactos.git] / reactos / lib / cpl / main / main.c
1 /*
2 * ReactOS
3 * Copyright (C) 2004 ReactOS Team
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program 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
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19 /* $Id$
20 *
21 * PROJECT: ReactOS Sample Control Panel
22 * FILE: lib/cpl/main/main.c
23 * PURPOSE: ReactOS Main Control Panel
24 * PROGRAMMER: Eric Kohl
25 * UPDATE HISTORY:
26 * 05-01-2004 Created
27 */
28 #include <windows.h>
29 #include <initguid.h>
30 #include <devguid.h>
31 #include <commctrl.h>
32 #include <cpl.h>
33
34 #include "main.h"
35 #include "resource.h"
36
37
38 #define NUM_APPLETS (2)
39
40
41 HINSTANCE hApplet = 0;
42
43
44 /* Applets */
45 APPLET Applets[NUM_APPLETS] =
46 {
47 {IDC_CPLICON_1, IDS_CPLNAME_1, IDS_CPLDESCRIPTION_1, MouseApplet},
48 {IDC_CPLICON_2, IDS_CPLNAME_2, IDS_CPLDESCRIPTION_2, KeyboardApplet}
49 };
50
51
52 VOID
53 InitPropSheetPage(PROPSHEETPAGE *psp, WORD idDlg, DLGPROC DlgProc)
54 {
55 ZeroMemory(psp, sizeof(PROPSHEETPAGE));
56 psp->dwSize = sizeof(PROPSHEETPAGE);
57 psp->dwFlags = PSP_DEFAULT;
58 psp->hInstance = hApplet;
59 psp->pszTemplate = MAKEINTRESOURCE(idDlg);
60 psp->pfnDlgProc = DlgProc;
61 }
62
63
64 /* Control Panel Callback */
65 LONG CALLBACK
66 CPlApplet(HWND hwndCpl,
67 UINT uMsg,
68 LPARAM lParam1,
69 LPARAM lParam2)
70 {
71 switch(uMsg)
72 {
73 case CPL_INIT:
74 return TRUE;
75
76 case CPL_GETCOUNT:
77 return NUM_APPLETS;
78
79 case CPL_INQUIRE:
80 {
81 CPLINFO *CPlInfo = (CPLINFO*)lParam2;
82 UINT uAppIndex = (UINT)lParam1;
83
84 CPlInfo->lData = 0;
85 CPlInfo->idIcon = Applets[uAppIndex].idIcon;
86 CPlInfo->idName = Applets[uAppIndex].idName;
87 CPlInfo->idInfo = Applets[uAppIndex].idDescription;
88 break;
89 }
90
91 case CPL_DBLCLK:
92 {
93 UINT uAppIndex = (UINT)lParam1;
94 Applets[uAppIndex].AppletProc(hwndCpl, uMsg, lParam1, lParam2);
95 break;
96 }
97 }
98
99 return FALSE;
100 }
101
102
103 BOOL STDCALL
104 DllMain(HINSTANCE hinstDLL,
105 DWORD dwReason,
106 LPVOID lpReserved)
107 {
108 switch(dwReason)
109 {
110 case DLL_PROCESS_ATTACH:
111 case DLL_THREAD_ATTACH:
112 hApplet = hinstDLL;
113 break;
114 }
115
116 return TRUE;
117 }
118