ReactOS 0.4.15-dev-8058-ga7cbb60
timedate.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Timedate Control Panel
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: dll/cpl/timedate/timedate.c
5 * PURPOSE: ReactOS Timedate Control Panel
6 * COPYRIGHT: Copyright 2004-2005 Eric Kohl
7 * Copyright 2006 Ged Murphy <gedmurphy@gmail.com>
8 *
9 */
10
11#include "timedate.h"
12
13#define NUM_APPLETS 1
14
16
18
19/* Applets */
21{
23};
24
25#if DBG
26VOID DisplayWin32ErrorDbg(DWORD dwErrorCode, const char *file, int line)
27#else
29#endif
30{
31 PWSTR lpMsgBuf;
32#if DBG
33 WCHAR szMsg[255];
34#endif
35
39 NULL,
40 dwErrorCode,
42 (LPWSTR) &lpMsgBuf,
43 0,
44 NULL );
45
46#if DBG
47 if (swprintf(szMsg, L"%hs:%d: %s", file, line, (PWSTR)lpMsgBuf))
48 {
50 }
51#else
52 MessageBox(NULL, lpMsgBuf, NULL, MB_OK | MB_ICONERROR);
53#endif
54
55 LocalFree(lpMsgBuf);
56}
57
58
59static VOID
61{
62 ZeroMemory(psp, sizeof(PROPSHEETPAGEW));
63 psp->dwSize = sizeof(PROPSHEETPAGEW);
64 psp->dwFlags = PSP_DEFAULT;
65 psp->hInstance = hApplet;
67 psp->pfnDlgProc = DlgProc;
68}
69
70static int CALLBACK
72{
73 // NOTE: This callback is needed to set large icon correctly.
75 switch (uMsg)
76 {
78 {
80 SendMessageW(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
81 break;
82 }
83 }
84 return 0;
85}
86
87static LONG APIENTRY
89{
91 PROPSHEETPAGEW psp[3];
92 LONG Ret = 0;
93
97
100 {
101 ZeroMemory(&psh, sizeof(PROPSHEETHEADERW));
102 psh.dwSize = sizeof(PROPSHEETHEADERW);
104 psh.hwndParent = hwnd;
105 psh.hInstance = hApplet;
106 psh.pszIcon = MAKEINTRESOURCEW(IDC_CPLICON);
107 psh.pszCaption = MAKEINTRESOURCEW(IDS_CPLNAME);
108 psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGEW);
109 psh.nStartPage = 0;
110 psh.ppsp = psp;
111 psh.pfnCallback = PropSheetProc;
112
116
117 Ret = (LONG)(PropertySheetW(&psh) != -1);
118
121 }
122
123 return Ret;
124}
125
126
127/* Control Panel Callback */
130 UINT uMsg,
131 LPARAM lParam1,
132 LPARAM lParam2)
133{
134 UINT i = (UINT)lParam1;
135
136 switch (uMsg)
137 {
138 case CPL_INIT:
139 return TRUE;
140
141 case CPL_GETCOUNT:
142 return NUM_APPLETS;
143
144 case CPL_INQUIRE:
145 if (i < NUM_APPLETS)
146 {
147 CPLINFO *CPlInfo = (CPLINFO*)lParam2;
148 CPlInfo->lData = 0;
149 CPlInfo->idIcon = Applets[i].idIcon;
150 CPlInfo->idName = Applets[i].idName;
151 CPlInfo->idInfo = Applets[i].idDescription;
152 }
153 else
154 {
155 return TRUE;
156 }
157 break;
158
159 case CPL_DBLCLK:
160 if (i < NUM_APPLETS)
161 Applets[i].AppletProc(hwndCpl, uMsg, lParam1, lParam2);
162 else
163 return TRUE;
164 break;
165 }
166 return FALSE;
167}
168
169
173 LPVOID lpReserved)
174{
175 UNREFERENCED_PARAMETER(lpReserved);
176
177 switch (dwReason)
178 {
180 {
182
183 InitControls.dwSize = sizeof(INITCOMMONCONTROLSEX);
186
187 hApplet = hinstDLL;
188 }
189 break;
190 }
191
192 return TRUE;
193}
DWORD dwReason
Definition: misc.cpp:154
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
BOOL WINAPI InitCommonControlsEx(const INITCOMMONCONTROLSEX *lpInitCtrls)
Definition: commctrl.c:893
#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
INT_PTR CALLBACK DateTimePageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: dateandtime.c:265
#define DLGPROC
Definition: maze.c:62
WORD idDlg
Definition: desk.c:121
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 IDC_CPLICON
Definition: resource.h:7
#define IDS_CPLNAME
Definition: resource.h:8
#define IDS_CPLDESCRIPTION
Definition: resource.h:9
VOID UnregisterClockControl(VOID)
Definition: clock.c:299
BOOL RegisterClockControl(VOID)
Definition: clock.c:283
BOOL RegisterMonthCalControl(IN HINSTANCE hInstance)
Definition: monthcal.c:1097
VOID UnregisterMonthCalControl(IN HINSTANCE hInstance)
Definition: monthcal.c:1114
#define IDD_INETTIMEPAGE
Definition: resource.h:21
#define IDD_TIMEZONEPAGE
Definition: resource.h:15
#define IDD_DATETIMEPAGE
Definition: resource.h:5
#define APIENTRY
Definition: api.h:79
INT_PTR WINAPI PropertySheetW(LPCPROPSHEETHEADERW lppsh)
Definition: propsheet.c:2913
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
#define CALLBACK
Definition: compat.h:35
DWORD WINAPI FormatMessageW(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPWSTR lpBuffer, DWORD nSize, __ms_va_list *args)
Definition: format_msg.c:583
#define swprintf
Definition: precomp.h:40
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
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
INT_PTR CALLBACK InetTimePageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: internettime.c:381
static HICON
Definition: imagelist.c:84
static VOID InitControls(HWND hwnd)
Definition: mplay32.c:303
HICON hIcon
Definition: msconfig.c:44
unsigned int UINT
Definition: ndis.h:50
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
#define L(x)
Definition: ntvdm.h:50
long LONG
Definition: pedump.c:60
#define PROPSHEETHEADER
Definition: prsht.h:392
#define PSH_PROPTITLE
Definition: prsht.h:40
#define PSH_USECALLBACK
Definition: prsht.h:48
#define PSP_DEFAULT
Definition: prsht.h:22
struct _PROPSHEETPAGEW PROPSHEETPAGEW
#define PSH_PROPSHEETPAGE
Definition: prsht.h:43
#define PSH_USEICONID
Definition: prsht.h:42
#define PSCB_INITIALIZED
Definition: prsht.h:75
struct _PROPSHEETHEADERW PROPSHEETHEADERW
struct tagINITCOMMONCONTROLSEX INITCOMMONCONTROLSEX
#define ICC_DATE_CLASSES
Definition: commctrl.h:67
#define ICC_PROGRESS_CLASS
Definition: commctrl.h:63
#define ICC_UPDOWN_CLASS
Definition: commctrl.h:62
#define LANG_NEUTRAL
Definition: nls.h:22
#define MAKELANGID(p, s)
Definition: nls.h:15
#define SUBLANG_DEFAULT
Definition: nls.h:168
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
DLGPROC pfnDlgProc
Definition: prsht.h:226
DWORD dwSize
Definition: prsht.h:214
DWORD dwFlags
Definition: prsht.h:215
LPCWSTR pszTemplate
Definition: prsht.h:218
HINSTANCE hInstance
Definition: prsht.h:216
Definition: fci.c:127
Definition: parser.c:49
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 NUM_APPLETS
Definition: timedate.c:13
static VOID InitPropSheetPage(PROPSHEETPAGEW *psp, WORD idDlg, DLGPROC DlgProc)
Definition: timedate.c:60
static int CALLBACK PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam)
Definition: timedate.c:71
static LONG APIENTRY Applet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam)
Definition: timedate.c:88
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpReserved)
Definition: timedate.c:171
APPLET Applets[NUM_APPLETS]
Definition: timedate.c:20
VOID DisplayWin32Error(DWORD dwErrorCode)
Definition: timedate.c:28
HINSTANCE hApplet
Definition: timedate.c:17
INT_PTR CALLBACK TimeZonePageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: timezone.c:272
#define ICON_BIG
Definition: tnclass.cpp:51
uint16_t * PWSTR
Definition: typedefs.h:56
#define ZeroMemory
Definition: winbase.h:1712
#define FORMAT_MESSAGE_IGNORE_INSERTS
Definition: winbase.h:420
#define FORMAT_MESSAGE_FROM_SYSTEM
Definition: winbase.h:423
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
Definition: winbase.h:419
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
LONG_PTR LPARAM
Definition: windef.h:208
#define WINAPI
Definition: msvc.h:6
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
#define MB_ICONERROR
Definition: winuser.h:787
#define MB_OK
Definition: winuser.h:790
#define MessageBox
Definition: winuser.h:5822
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE hInstance, _In_ LPCWSTR lpIconName)
Definition: cursoricon.c:2106
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184