ReactOS  0.4.14-dev-552-g2fad488
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  WCHAR Caption[256];
93  LONG Ret = 0;
94 
98 
101  {
102  LoadStringW(hApplet, IDS_CPLNAME, Caption, sizeof(Caption) / sizeof(WCHAR));
103 
104  ZeroMemory(&psh, sizeof(PROPSHEETHEADERW));
105  psh.dwSize = sizeof(PROPSHEETHEADERW);
107  psh.hwndParent = hwnd;
108  psh.hInstance = hApplet;
109  psh.pszIcon = MAKEINTRESOURCEW(IDC_CPLICON);
110  psh.pszCaption = Caption;
111  psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGEW);
112  psh.nStartPage = 0;
113  psh.ppsp = psp;
114  psh.pfnCallback = PropSheetProc;
115 
119 
120  Ret = (LONG)(PropertySheetW(&psh) != -1);
121 
124  }
125 
126  return Ret;
127 }
static int CALLBACK PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam)
Definition: timedate.c:71
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define ZeroMemory
Definition: winbase.h:1642
#define IDD_DATETIMEPAGE
Definition: resource.h:5
struct _PROPSHEETHEADERW PROPSHEETHEADERW
#define PSH_USECALLBACK
Definition: prsht.h:48
#define IDC_CPLICON
Definition: resource.h:7
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
WPARAM wParam
Definition: combotst.c:138
#define IDD_TIMEZONEPAGE
Definition: resource.h:15
BOOL RegisterMonthCalControl(IN HINSTANCE hInstance)
Definition: monthcal.c:1102
INT_PTR CALLBACK TimeZonePageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: timezone.c:389
#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:258
#define PROPSHEETHEADER
Definition: prsht.h:374
INT_PTR WINAPI PropertySheetW(LPCPROPSHEETHEADERW lppsh)
Definition: propsheet.c:2905
VOID UnregisterClockControl(VOID)
Definition: clock.c:290
__wchar_t WCHAR
Definition: xmlstorage.h:180
#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:1119
#define PSH_PROPSHEETPAGE
Definition: prsht.h:43
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
BOOL RegisterClockControl(VOID)
Definition: clock.c:274
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 132 of file timedate.c.

136 {
137  INT i = (INT)lParam1;
138 
139  switch (uMsg)
140  {
141  case CPL_INIT:
142  return TRUE;
143 
144  case CPL_GETCOUNT:
145  return NUM_APPLETS;
146 
147  case CPL_INQUIRE:
148  {
149  CPLINFO *CPlInfo = (CPLINFO*)lParam2;
150  CPlInfo->lData = 0;
151  CPlInfo->idIcon = Applets[i].idIcon;
152  CPlInfo->idName = Applets[i].idName;
153  CPlInfo->idInfo = Applets[i].idDescription;
154  }
155  break;
156 
157  case CPL_DBLCLK:
158  {
159  Applets[i].AppletProc(hwndCpl, uMsg, lParam1, lParam2);
160  }
161  break;
162  }
163  return FALSE;
164 }
#define TRUE
Definition: types.h:120
Definition: cpl.h:24
int idName
Definition: hotplug.h:27
#define INT
Definition: polytest.cpp:20
int idIcon
Definition: hotplug.h:26
int idInfo
Definition: cpl.h:27
int32_t INT
Definition: typedefs.h:56
int idIcon
Definition: cpl.h:25
int idDescription
Definition: hotplug.h:28
#define CPL_DBLCLK
Definition: cpl.h:16
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_PROC AppletProc
Definition: hotplug.h:29
#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
APPLET Applets[NUM_APPLETS]
Definition: timedate.c:20
#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:54
#define LANG_NEUTRAL
Definition: nls.h:22
#define SUBLANG_DEFAULT
Definition: nls.h:168
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 FORMAT_MESSAGE_ALLOCATE_BUFFER
Definition: winbase.h:400
smooth NULL
Definition: ftsmooth.c:416
Definition: parser.c:48
#define FORMAT_MESSAGE_FROM_SYSTEM
Definition: winbase.h:404
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define swprintf(buf, format,...)
Definition: sprintf.c:56
static const WCHAR L[]
Definition: oid.c:1250
#define MB_ICONERROR
Definition: winuser.h:781
#define MessageBox
Definition: winuser.h:5797
#define FORMAT_MESSAGE_IGNORE_INSERTS
Definition: winbase.h:401
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#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 InetTimePageProc(), OnAutoSync(), and SetNTPServer().

◆ DllMain()

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

Definition at line 168 of file timedate.c.

171 {
172  UNREFERENCED_PARAMETER(lpReserved);
173 
174  switch (dwReason)
175  {
176  case DLL_PROCESS_ATTACH:
177  {
179 
180  InitControls.dwSize = sizeof(INITCOMMONCONTROLSEX);
183 
184  hApplet = hinstDLL;
185  }
186  break;
187  }
188 
189  return TRUE;
190 }
#define TRUE
Definition: types.h:120
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define DLL_PROCESS_ATTACH
Definition: compat.h:120
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:109
LPCWSTR pszTemplate
Definition: prsht.h:209
#define ZeroMemory
Definition: winbase.h:1642
DWORD dwSize
Definition: prsht.h:205
DLGPROC pfnDlgProc
Definition: prsht.h:217
struct _PROPSHEETPAGEW PROPSHEETPAGEW
#define PSP_DEFAULT
Definition: prsht.h:22
HINSTANCE hApplet
Definition: timedate.c:17
HINSTANCE hInstance
Definition: prsht.h:207
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
DLGPROC DlgProc
Definition: desk.c:110
DWORD dwFlags
Definition: prsht.h:206

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().