- Update to r53061
[reactos.git] / dll / cpl / input / input.c
1 /*
2 *
3 * PROJECT: input.dll
4 * FILE: dll/win32/input/input.c
5 * PURPOSE: input.dll
6 * PROGRAMMER: Dmitry Chapyshev (lentind@yandex.ru)
7 * Colin Finck
8 * UPDATE HISTORY:
9 * 06-09-2007 Created
10 */
11
12 #include "input.h"
13
14 #define NUM_APPLETS (1)
15
16 LONG CALLBACK SystemApplet(VOID);
17 HINSTANCE hApplet = 0;
18 HANDLE hProcessHeap;
19 HWND hCPLWindow;
20
21 /* Applets */
22 APPLET Applets[NUM_APPLETS] =
23 {
24 {IDI_CPLSYSTEM, IDS_CPLSYSTEMNAME, IDS_CPLSYSTEMDESCRIPTION, SystemApplet}
25 };
26
27
28 VOID
29 InitPropSheetPage(PROPSHEETPAGE *psp, WORD idDlg, DLGPROC DlgProc)
30 {
31 ZeroMemory(psp, sizeof(PROPSHEETPAGE));
32 psp->dwSize = sizeof(PROPSHEETPAGE);
33 psp->dwFlags = PSP_DEFAULT;
34 psp->hInstance = hApplet;
35 psp->pszTemplate = MAKEINTRESOURCE(idDlg);
36 psp->pfnDlgProc = DlgProc;
37 }
38
39
40 /* First Applet */
41
42 LONG CALLBACK
43 SystemApplet(VOID)
44 {
45 PROPSHEETPAGE psp[1];
46 PROPSHEETHEADER psh;
47 TCHAR Caption[1024];
48
49 LoadString(hApplet, IDS_CPLSYSTEMNAME, Caption, sizeof(Caption) / sizeof(TCHAR));
50
51 ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
52 psh.dwSize = sizeof(PROPSHEETHEADER);
53 psh.dwFlags = PSH_PROPSHEETPAGE;
54 psh.hwndParent = hCPLWindow;
55 psh.hInstance = hApplet;
56 psh.hIcon = LoadIcon(hApplet, MAKEINTRESOURCE(IDI_CPLSYSTEM));
57 psh.pszCaption = Caption;
58 psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE);
59 psh.nStartPage = 0;
60 psh.ppsp = psp;
61 psh.pfnCallback = NULL;
62
63 InitPropSheetPage(&psp[0], IDD_PROPPAGESETTINGS, (DLGPROC) SettingPageProc);
64
65 return (LONG)(PropertySheet(&psh) != -1);
66 }
67
68
69 /* Control Panel Callback */
70 LONG CALLBACK
71 CPlApplet(HWND hwndCPl, UINT uMsg, LPARAM lParam1, LPARAM lParam2)
72 {
73 CPLINFO *CPlInfo;
74 DWORD i;
75
76 i = (DWORD)lParam1;
77 switch (uMsg)
78 {
79 case CPL_INIT:
80 return TRUE;
81
82 case CPL_GETCOUNT:
83 return NUM_APPLETS;
84
85 case CPL_INQUIRE:
86 CPlInfo = (CPLINFO*)lParam2;
87 CPlInfo->lData = 0;
88 CPlInfo->idIcon = Applets[i].idIcon;
89 CPlInfo->idName = Applets[i].idName;
90 CPlInfo->idInfo = Applets[i].idDescription;
91 break;
92
93 case CPL_DBLCLK:
94 hCPLWindow = hwndCPl;
95 Applets[i].AppletProc();
96 break;
97 }
98
99 return FALSE;
100 }
101
102
103 BOOL WINAPI
104 DllMain(HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpvReserved)
105 {
106 UNREFERENCED_PARAMETER(lpvReserved);
107
108 switch (dwReason)
109 {
110 case DLL_PROCESS_ATTACH:
111 case DLL_THREAD_ATTACH:
112 hApplet = hinstDLL;
113 hProcessHeap = GetProcessHeap();
114 break;
115 }
116
117 return TRUE;
118 }
119
120 /* EOF */