ReactOS 0.4.15-dev-7674-gc0b4db1
input.c
Go to the documentation of this file.
1/*
2 * PROJECT: input.dll
3 * FILE: dll/cpl/input/input.c
4 * PURPOSE: input.dll
5 * PROGRAMMER: Dmitry Chapyshev (lentind@yandex.ru)
6 * Colin Finck
7 * UPDATE HISTORY:
8 * 06-09-2007 Created
9 */
10
11#include "input.h"
12
13#define NUM_APPLETS (1)
14
15static LONG CALLBACK SystemApplet(HWND hwnd, UINT uMsg, LPARAM lParam1, LPARAM lParam2);
16
19
20/* Applets */
22{
24};
25
26
27static VOID
29{
30 ZeroMemory(page, sizeof(*page));
31
32 page->dwSize = sizeof(*page);
33 page->dwFlags = PSP_DEFAULT;
34 page->hInstance = hApplet;
35 page->pszTemplate = MAKEINTRESOURCEW(idDlg);
36 page->pfnDlgProc = DlgProc;
37}
38
39static BOOL AskForReboot(HWND hwndDlg)
40{
41 WCHAR szText[128], szCaption[64];
42 LoadStringW(hApplet, IDS_REBOOT_NOW, szText, _countof(szText));
43 LoadStringW(hApplet, IDS_LANGUAGE, szCaption, _countof(szCaption));
44 return (MessageBoxW(hwndDlg, szText, szCaption, MB_ICONINFORMATION | MB_YESNO) == IDYES);
45}
46
47static int CALLBACK
49{
50 switch (uMsg)
51 {
53 {
54 /* Set large icon correctly */
56 SendMessageW(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
57 break;
58 }
59
60 case PSCB_BUTTONPRESSED:
61 {
62 switch (lParam)
63 {
64 case PSBTN_OK:
65 case PSBTN_APPLYNOW:
66 {
67 if (g_bRebootNeeded && AskForReboot(hwndDlg))
68 {
71 }
72 break;
73 }
74 }
75 break;
76 }
77 }
78 return 0;
79}
80
81/* First Applet */
82static LONG CALLBACK
83SystemApplet(HWND hwnd, UINT uMsg, LPARAM lParam1, LPARAM lParam2)
84{
87
88 ZeroMemory(&header, sizeof(header));
89
90 header.dwSize = sizeof(header);
92 header.hwndParent = hwnd;
93 header.hInstance = hApplet;
96 header.nPages = ARRAYSIZE(page);
97 header.nStartPage = 0;
98 header.ppsp = page;
99 header.pfnCallback = PropSheetProc;
100
101 /* Settings */
103
104 /* Advanced Settings */
106
107 return (LONG)(PropertySheetW(&header) != -1);
108}
109
110
111/* Control Panel Callback */
113CPlApplet(HWND hwndCPl, UINT uMsg, LPARAM lParam1, LPARAM lParam2)
114{
115 CPLINFO *CPlInfo;
116 UINT i = (UINT)lParam1;
117
118 switch (uMsg)
119 {
120 case CPL_INIT:
121 return TRUE;
122
123 case CPL_GETCOUNT:
124 return NUM_APPLETS;
125
126 case CPL_INQUIRE:
127 if (i < NUM_APPLETS)
128 {
129 CPlInfo = (CPLINFO*)lParam2;
130 CPlInfo->lData = 0;
131 CPlInfo->idIcon = Applets[i].idIcon;
132 CPlInfo->idName = Applets[i].idName;
133 CPlInfo->idInfo = Applets[i].idDescription;
134 }
135 else
136 {
137 return TRUE;
138 }
139 break;
140
141 case CPL_DBLCLK:
142 if (i < NUM_APPLETS)
143 Applets[i].AppletProc(hwndCPl, uMsg, lParam1, lParam2);
144 else
145 return TRUE;
146 break;
147 }
148
149 return FALSE;
150}
151
152
155{
157
158 switch (dwReason)
159 {
162 hApplet = hinstDLL;
163 break;
164 }
165
166 return TRUE;
167}
168
169/* EOF */
INT_PTR CALLBACK AdvancedSettingsPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
DWORD dwReason
Definition: misc.cpp:154
LPARAM lParam
Definition: combotst.c:139
#define CPL_INQUIRE
Definition: cpl.h:14
#define CPL_DBLCLK
Definition: cpl.h:16
#define CPL_INIT
Definition: cpl.h:12
#define CPL_GETCOUNT
Definition: cpl.h:13
#define DLGPROC
Definition: maze.c:62
WORD idDlg
Definition: desk.c:121
INT_PTR CALLBACK SettingsPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
DLGPROC DlgProc
Definition: desk.c:122
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define IDS_CPLSYSTEMNAME
Definition: resource.h:23
#define IDS_CPLSYSTEMDESCRIPTION
Definition: resource.h:24
#define IDI_CPLSYSTEM
Definition: resource.h:4
static LONG CALLBACK SystemApplet(HWND hwnd, UINT uMsg, LPARAM lParam1, LPARAM lParam2)
Definition: input.c:83
#define NUM_APPLETS
Definition: input.c:13
static int CALLBACK PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam)
Definition: input.c:48
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpvReserved)
Definition: input.c:154
static BOOL AskForReboot(HWND hwndDlg)
Definition: input.c:39
static VOID InitPropSheetPage(PROPSHEETPAGEW *page, WORD idDlg, DLGPROC DlgProc)
Definition: input.c:28
BOOL g_bRebootNeeded
Definition: input.c:18
static APPLET Applets[NUM_APPLETS]
Definition: input.c:21
HINSTANCE hApplet
Definition: input.c:17
BOOL EnableProcessPrivileges(LPCWSTR lpPrivilegeName, BOOL bEnable)
#define IDS_LANGUAGE
Definition: resource.h:52
#define IDD_PROPPAGEADVANCEDSETTINGS
Definition: resource.h:14
#define IDS_REBOOT_NOW
Definition: resource.h:62
#define IDD_PROPPAGESETTINGS
Definition: resource.h:13
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
INT_PTR WINAPI PropertySheetW(LPCPROPSHEETHEADERW lppsh)
Definition: propsheet.c:2913
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
#define CALLBACK
Definition: compat.h:35
#define DLL_THREAD_ATTACH
Definition: compat.h:132
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static IN DWORD IN LPVOID lpvReserved
static HICON
Definition: imagelist.c:84
HICON hIcon
Definition: msconfig.c:44
unsigned int UINT
Definition: ndis.h:50
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
long LONG
Definition: pedump.c:60
#define PSH_USECALLBACK
Definition: prsht.h:48
#define PSP_DEFAULT
Definition: prsht.h:22
#define PSBTN_APPLYNOW
Definition: prsht.h:150
#define PSH_PROPSHEETPAGE
Definition: prsht.h:43
#define PSH_USEICONID
Definition: prsht.h:42
#define PSCB_INITIALIZED
Definition: prsht.h:75
#define PSBTN_OK
Definition: prsht.h:149
#define _countof(array)
Definition: sndvol32.h:68
Definition: hotplug.h:34
int idDescription
Definition: hotplug.h:37
int idName
Definition: hotplug.h:36
int idIcon
Definition: hotplug.h:35
APPLET_PROC AppletProc
Definition: hotplug.h:38
Definition: module.h:576
Definition: cpl.h:24
LONG_PTR lData
Definition: cpl.h:28
int idName
Definition: cpl.h:26
int idInfo
Definition: cpl.h:27
int idIcon
Definition: cpl.h:25
#define ICON_BIG
Definition: tnclass.cpp:51
#define ZeroMemory
Definition: winbase.h:1712
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
LONG_PTR LPARAM
Definition: windef.h:208
#define WINAPI
Definition: msvc.h:6
#define SE_SHUTDOWN_NAME
Definition: winnt_old.h:384
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define MB_YESNO
Definition: winuser.h:816
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
#define EWX_REBOOT
Definition: winuser.h:638
#define EWX_FORCE
Definition: winuser.h:635
BOOL WINAPI ExitWindowsEx(_In_ UINT, _In_ DWORD)
#define MB_ICONINFORMATION
Definition: winuser.h:801
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define IDYES
Definition: winuser.h:834
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE hInstance, _In_ LPCWSTR lpIconName)
Definition: cursoricon.c:2058
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
__wchar_t WCHAR
Definition: xmlstorage.h:180