ReactOS  0.4.15-dev-5109-g2469ce2
timedate.c File Reference
#include "timedate.h"
Include dependency graph for timedate.c:

Go to the source code of this file.

Macros

#define NUM_APPLETS   1
 

Functions

static LONG APIENTRY Applet (HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam)
 
VOID DisplayWin32Error (DWORD dwErrorCode)
 
static VOID InitPropSheetPage (PROPSHEETPAGEW *psp, WORD idDlg, DLGPROC DlgProc)
 
static int CALLBACK PropSheetProc (HWND hwndDlg, UINT uMsg, LPARAM lParam)
 
LONG CALLBACK CPlApplet (HWND hwndCpl, UINT uMsg, LPARAM lParam1, LPARAM lParam2)
 
BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpReserved)
 

Variables

HINSTANCE hApplet
 
APPLET Applets [NUM_APPLETS]
 

Macro Definition Documentation

◆ NUM_APPLETS

#define NUM_APPLETS   1

Definition at line 13 of file timedate.c.

Function Documentation

◆ Applet()

static LONG APIENTRY Applet ( HWND  hwnd,
UINT  uMsg,
LPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 88 of file timedate.c.

89 {
90  PROPSHEETHEADER psh;
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 }
static int CALLBACK PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam)
Definition: timedate.c:71
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
#define ZeroMemory
Definition: winbase.h:1667
#define IDD_DATETIMEPAGE
Definition: resource.h:5
struct _PROPSHEETHEADERW PROPSHEETHEADERW
#define PSH_USECALLBACK
Definition: prsht.h:48
#define IDC_CPLICON
Definition: resource.h:7
WPARAM wParam
Definition: combotst.c:138
#define IDD_TIMEZONEPAGE
Definition: resource.h:15
BOOL RegisterMonthCalControl(IN HINSTANCE hInstance)
Definition: monthcal.c:1097
INT_PTR CALLBACK TimeZonePageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: timezone.c:257
#define IDS_CPLNAME
Definition: resource.h:8
#define PSH_USEICONID
Definition: prsht.h:42
#define IDD_INETTIMEPAGE
Definition: resource.h:21
long LONG
Definition: pedump.c:60
INT_PTR CALLBACK InetTimePageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: internettime.c:381
#define PROPSHEETHEADER
Definition: prsht.h:392
INT_PTR WINAPI PropertySheetW(LPCPROPSHEETHEADERW lppsh)
Definition: propsheet.c:2905
VOID UnregisterClockControl(VOID)
Definition: clock.c:299
#define PSH_PROPTITLE
Definition: prsht.h:40
INT_PTR CALLBACK DateTimePageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: dateandtime.c:265
HINSTANCE hApplet
Definition: timedate.c:17
VOID UnregisterMonthCalControl(IN HINSTANCE hInstance)
Definition: monthcal.c:1114
#define PSH_PROPSHEETPAGE
Definition: prsht.h:43
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
BOOL RegisterClockControl(VOID)
Definition: clock.c:283
LPARAM lParam
Definition: combotst.c:139
static VOID InitPropSheetPage(PROPSHEETPAGEW *psp, WORD idDlg, DLGPROC DlgProc)
Definition: timedate.c:60

◆ CPlApplet()

LONG CALLBACK CPlApplet ( HWND  hwndCpl,
UINT  uMsg,
LPARAM  lParam1,
LPARAM  lParam2 
)

Definition at line 129 of file timedate.c.

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 }
Definition: cpl.h:24
#define TRUE
Definition: types.h:120
int idName
Definition: hotplug.h:36
int idIcon
Definition: hotplug.h:35
int idInfo
Definition: cpl.h:27
int idIcon
Definition: cpl.h:25
int idDescription
Definition: hotplug.h:37
#define CPL_DBLCLK
Definition: cpl.h:16
#define FALSE
Definition: types.h:117
APPLET_PROC AppletProc
Definition: hotplug.h:38
#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
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
APPLET Applets[NUM_APPLETS]
Definition: timedate.c:20
unsigned int UINT
Definition: ndis.h:50
#define NUM_APPLETS
Definition: timedate.c:13
#define CPL_GETCOUNT
Definition: cpl.h:13

◆ DisplayWin32Error()

VOID DisplayWin32Error ( DWORD  dwErrorCode)

Definition at line 28 of file timedate.c.

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 }
uint16_t * PWSTR
Definition: typedefs.h:56
#define LANG_NEUTRAL
Definition: nls.h:22
#define SUBLANG_DEFAULT
Definition: nls.h:168
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
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 L(x)
Definition: ntvdm.h:50
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
Definition: winbase.h:416
Definition: parser.c:48
#define FORMAT_MESSAGE_FROM_SYSTEM
Definition: winbase.h:420
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MB_ICONERROR
Definition: winuser.h:781
#define MessageBox
Definition: winuser.h:5812
int _cdecl swprintf(const WCHAR *,...)
#define FORMAT_MESSAGE_IGNORE_INSERTS
Definition: winbase.h:417
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define NULL
Definition: types.h:112
#define MB_OK
Definition: winuser.h:784
#define MAKELANGID(p, s)
Definition: nls.h:15
WCHAR * LPWSTR
Definition: xmlstorage.h:184
Definition: fci.c:126

Referenced by OnAutoSync(), and SetNTPServer().

◆ DllMain()

BOOL WINAPI DllMain ( HINSTANCE  hinstDLL,
DWORD  dwReason,
LPVOID  lpReserved 
)

Definition at line 171 of file timedate.c.

174 {
175  UNREFERENCED_PARAMETER(lpReserved);
176 
177  switch (dwReason)
178  {
179  case DLL_PROCESS_ATTACH:
180  {
182 
183  InitControls.dwSize = sizeof(INITCOMMONCONTROLSEX);
186 
187  hApplet = hinstDLL;
188  }
189  break;
190  }
191 
192  return TRUE;
193 }
#define TRUE
Definition: types.h:120
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
struct tagINITCOMMONCONTROLSEX INITCOMMONCONTROLSEX
static VOID InitControls(HWND hwnd)
Definition: mplay32.c:303
DWORD dwReason
Definition: misc.cpp:154
#define ICC_UPDOWN_CLASS
Definition: commctrl.h:62
#define ICC_DATE_CLASSES
Definition: commctrl.h:67
HINSTANCE hApplet
Definition: timedate.c:17
BOOL WINAPI InitCommonControlsEx(const INITCOMMONCONTROLSEX *lpInitCtrls)
Definition: commctrl.c:893
#define ICC_PROGRESS_CLASS
Definition: commctrl.h:63

◆ InitPropSheetPage()

static VOID InitPropSheetPage ( PROPSHEETPAGEW psp,
WORD  idDlg,
DLGPROC  DlgProc 
)
static

Definition at line 60 of file timedate.c.

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 }
WORD idDlg
Definition: desk.c:110
LPCWSTR pszTemplate
Definition: prsht.h:218
#define ZeroMemory
Definition: winbase.h:1667
DWORD dwSize
Definition: prsht.h:214
DLGPROC pfnDlgProc
Definition: prsht.h:226
struct _PROPSHEETPAGEW PROPSHEETPAGEW
#define PSP_DEFAULT
Definition: prsht.h:22
HINSTANCE hApplet
Definition: timedate.c:17
HINSTANCE hInstance
Definition: prsht.h:216
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
DLGPROC DlgProc
Definition: desk.c:111
DWORD dwFlags
Definition: prsht.h:215

Referenced by Applet().

◆ PropSheetProc()

static int CALLBACK PropSheetProc ( HWND  hwndDlg,
UINT  uMsg,
LPARAM  lParam 
)
static

Definition at line 71 of file timedate.c.

72 {
73  // NOTE: This callback is needed to set large icon correctly.
74  HICON hIcon;
75  switch (uMsg)
76  {
77  case PSCB_INITIALIZED:
78  {
80  SendMessageW(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
81  break;
82  }
83  }
84  return 0;
85 }
static HICON
Definition: imagelist.c:84
#define IDC_CPLICON
Definition: resource.h:7
LONG_PTR LPARAM
Definition: windef.h:208
HINSTANCE hApplet
Definition: timedate.c:17
#define PSCB_INITIALIZED
Definition: prsht.h:75
HICON hIcon
Definition: msconfig.c:44
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2044
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define ICON_BIG
Definition: tnclass.cpp:51

Referenced by Applet().

Variable Documentation

◆ Applets

APPLET Applets[NUM_APPLETS]
Initial value:
=
{
}
#define IDC_CPLICON
Definition: resource.h:7
#define IDS_CPLNAME
Definition: resource.h:8
static LONG APIENTRY Applet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam)
Definition: timedate.c:88
#define IDS_CPLDESCRIPTION
Definition: resource.h:9

Definition at line 20 of file timedate.c.

Referenced by CPlApplet().

◆ hApplet

HINSTANCE hApplet

Definition at line 17 of file timedate.c.

Referenced by Applet(), DllMain(), InitPropSheetPage(), and PropSheetProc().