ReactOS  0.4.13-dev-443-g10f00f8
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 #include <cpl.h>
14 
15 #define NUM_APPLETS (1)
16 
18 
21 
22 /* Applets */
24 {
26 };
27 
28 
29 static VOID
31 {
32  ZeroMemory(page, sizeof(*page));
33 
34  page->dwSize = sizeof(*page);
35  page->dwFlags = PSP_DEFAULT;
36  page->hInstance = hApplet;
37  page->pszTemplate = MAKEINTRESOURCEW(idDlg);
38  page->pfnDlgProc = DlgProc;
39 }
40 
41 static int CALLBACK
43 {
44  // NOTE: This callback is needed to set large icon correctly.
45  HICON hIcon;
46  switch (uMsg)
47  {
48  case PSCB_INITIALIZED:
49  {
51  SendMessageW(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
52  break;
53  }
54  }
55  return 0;
56 }
57 
58 /* First Applet */
59 static LONG CALLBACK
61 {
64  WCHAR szCaption[MAX_STR_LEN];
65 
66  LoadStringW(hApplet, IDS_CPLSYSTEMNAME, szCaption, ARRAYSIZE(szCaption));
67 
68  ZeroMemory(&header, sizeof(header));
69 
70  header.dwSize = sizeof(header);
72  header.hwndParent = hCPLWindow;
73  header.hInstance = hApplet;
75  header.pszCaption = szCaption;
76  header.nPages = ARRAYSIZE(page);
77  header.nStartPage = 0;
78  header.ppsp = page;
79  header.pfnCallback = PropSheetProc;
80 
81  /* Settings */
83 
84  /* Advanced Settings */
86 
87  return (LONG)(PropertySheetW(&header) != -1);
88 }
89 
90 
91 /* Control Panel Callback */
93 CPlApplet(HWND hwndCPl, UINT uMsg, LPARAM lParam1, LPARAM lParam2)
94 {
95  CPLINFO *CPlInfo;
96  DWORD i;
97 
98  i = (DWORD)lParam1;
99 
100  switch (uMsg)
101  {
102  case CPL_INIT:
103  return TRUE;
104 
105  case CPL_GETCOUNT:
106  return NUM_APPLETS;
107 
108  case CPL_INQUIRE:
109  CPlInfo = (CPLINFO*)lParam2;
110  CPlInfo->lData = 0;
111  CPlInfo->idIcon = Applets[i].idIcon;
112  CPlInfo->idName = Applets[i].idName;
113  CPlInfo->idInfo = Applets[i].idDescription;
114  break;
115 
116  case CPL_DBLCLK:
117  hCPLWindow = hwndCPl;
118  Applets[i].AppletProc();
119  break;
120  }
121 
122  return FALSE;
123 }
124 
125 
126 BOOL WINAPI
128 {
130 
131  switch (dwReason)
132  {
133  case DLL_PROCESS_ATTACH:
134  case DLL_THREAD_ATTACH:
135  hApplet = hinstDLL;
136  break;
137  }
138 
139  return TRUE;
140 }
141 
142 /* EOF */
static DWORD
Definition: input.c:87
WORD idDlg
Definition: desk.c:109
static HICON
Definition: imagelist.c:84
#define TRUE
Definition: types.h:120
Definition: cpl.h:24
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define DLL_THREAD_ATTACH
Definition: compat.h:121
#define IDI_CPLSYSTEM
Definition: resource.h:4
INT_PTR CALLBACK AdvancedSettingsPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
int idName
Definition: hotplug.h:27
int idIcon
Definition: hotplug.h:26
#define CALLBACK
Definition: compat.h:27
int idInfo
Definition: cpl.h:27
HINSTANCE hApplet
Definition: input.c:19
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define ZeroMemory
Definition: winbase.h:1635
#define DLL_PROCESS_ATTACH
Definition: compat.h:120
#define PSH_USECALLBACK
Definition: prsht.h:48
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
static IN DWORD IN LPVOID lpvReserved
int idIcon
Definition: cpl.h:25
int idDescription
Definition: hotplug.h:28
#define CPL_DBLCLK
Definition: cpl.h:16
DWORD dwReason
Definition: misc.cpp:154
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
#define PSH_USEICONID
Definition: prsht.h:42
#define IDI_KEY_SHORT_ICO
Definition: resource.h:7
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
LONG CALLBACK CPlApplet(HWND hwndCPl, UINT uMsg, LPARAM lParam1, LPARAM lParam2)
Definition: input.c:93
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
Definition: module.h:566
INT_PTR WINAPI PropertySheetW(LPCPROPSHEETHEADERW lppsh)
Definition: propsheet.c:2896
#define IDS_CPLSYSTEMNAME
Definition: resource.h:23
#define PSP_DEFAULT
Definition: prsht.h:22
#define NUM_APPLETS
Definition: input.c:15
__wchar_t WCHAR
Definition: xmlstorage.h:180
APPLET_PROC AppletProc
Definition: hotplug.h:29
#define WINAPI
Definition: msvc.h:8
static HWND hCPLWindow
Definition: input.c:20
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
static APPLET Applets[NUM_APPLETS]
Definition: input.c:23
#define CPL_INIT
Definition: cpl.h:12
#define CPL_INQUIRE
Definition: cpl.h:14
LONG_PTR lData
Definition: cpl.h:28
int idName
Definition: cpl.h:26
static LONG CALLBACK SystemApplet(VOID)
Definition: input.c:60
INT_PTR(CALLBACK * DLGPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2849
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpvReserved)
Definition: input.c:127
#define PSCB_INITIALIZED
Definition: prsht.h:75
HICON hIcon
Definition: msconfig.c:44
#define PSH_PROPSHEETPAGE
Definition: prsht.h:43
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define IDS_CPLSYSTEMDESCRIPTION
Definition: resource.h:24
unsigned int UINT
Definition: ndis.h:50
static VOID InitPropSheetPage(PROPSHEETPAGEW *page, WORD idDlg, DLGPROC DlgProc)
Definition: input.c:30
#define MAX_STR_LEN
Definition: defines.h:33
#define IDD_PROPPAGEADVANCEDSETTINGS
Definition: resource.h:13
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2044
static int CALLBACK PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam)
Definition: input.c:42
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
INT_PTR CALLBACK SettingsPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
LPARAM lParam
Definition: combotst.c:139
DLGPROC DlgProc
Definition: desk.c:110
#define CPL_GETCOUNT
Definition: cpl.h:13
struct CFHEADER header
Definition: fdi.c:109
#define ICON_BIG
Definition: tnclass.cpp:51
Definition: hotplug.h:24
#define IDD_PROPPAGESETTINGS
Definition: resource.h:12