1 #ifndef _TIMEDATE_H 2 #define _TIMEDATE_H 3 4 #include <stdarg.h> 5 6 #define _INC_WINDOWS 7 #define COM_NO_WINDOWS_H 8 #define WIN32_NO_STATUS 9 10 #include <windef.h> 11 #include <winbase.h> 12 #include <winnls.h> 13 #include <winreg.h> 14 #include <wingdi.h> 15 #include <winuser.h> 16 #include <wchar.h> 17 #include <commctrl.h> 18 #include <cpl.h> 19 20 #include "resource.h" 21 22 #define MAX_KEY_LENGTH 255 23 #define MAX_VALUE_NAME 16383 24 #define SERVERLISTSIZE 6 25 #define BUFSIZE 1024 26 #define NTPPORT 123 27 #define ID_TIMER 1 28 29 typedef struct 30 { 31 UINT idIcon; 32 UINT idName; 33 UINT idDescription; 34 APPLET_PROC AppletProc; 35 } APPLET, *PAPPLET; 36 37 extern HINSTANCE hApplet; 38 39 40 /* dateandtime.c */ 41 INT_PTR CALLBACK DateTimePageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); 42 BOOL SystemSetTime(LPSYSTEMTIME lpSystemTime, BOOL SystemTime); 43 44 45 /* timezone.c */ 46 INT_PTR CALLBACK TimeZonePageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); 47 48 49 /* internettime.c */ 50 INT_PTR CALLBACK InetTimePageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); 51 52 53 /* timedate.c */ 54 #if DBG 55 VOID DisplayWin32ErrorDbg(DWORD dwErrorCode, const char *file, int line); 56 #define DisplayWin32Error(e) DisplayWin32ErrorDbg(e, __FILE__, __LINE__); 57 #else 58 VOID DisplayWin32Error(DWORD dwErrorCode); 59 #endif 60 61 62 /* clock.c */ 63 #define CLM_STOPCLOCK (WM_USER + 1) 64 #define CLM_STARTCLOCK (WM_USER + 2) 65 66 BOOL RegisterClockControl(VOID); 67 VOID UnregisterClockControl(VOID); 68 69 70 /* ntpclient.c */ 71 // NTP timestamp 72 typedef struct _TIMEPACKET 73 { 74 DWORD dwInteger; 75 DWORD dwFractional; 76 } TIMEPACKET, *PTIMEPACKET; 77 78 // NTP packet 79 typedef struct _NTPPACKET 80 { 81 BYTE LiVnMode; 82 BYTE Stratum; 83 char Poll; 84 char Precision; 85 long RootDelay; 86 long RootDispersion; 87 char ReferenceID[4]; 88 TIMEPACKET ReferenceTimestamp; 89 TIMEPACKET OriginateTimestamp; 90 TIMEPACKET ReceiveTimestamp; 91 TIMEPACKET TransmitTimestamp; 92 }NTPPACKET, *PNTPPACKET; 93 94 ULONG GetServerTime(LPWSTR lpAddress); 95 96 97 /* monthcal.c */ 98 #define MCCM_SETDATE (WM_USER + 1) 99 #define MCCM_GETDATE (WM_USER + 2) 100 #define MCCM_RESET (WM_USER + 3) 101 #define MCCM_CHANGED (WM_USER + 4) 102 103 #define MCCN_SELCHANGE (1) 104 typedef struct _NMMCCSELCHANGE 105 { 106 NMHDR hdr; 107 WORD OldDay; 108 WORD OldMonth; 109 WORD OldYear; 110 WORD NewDay; 111 WORD NewMonth; 112 WORD NewYear; 113 } NMMCCSELCHANGE, *PNMMCCSELCHANGE; 114 #define MCCN_AUTOUPDATE (2) 115 typedef struct _NMMCCAUTOUPDATE 116 { 117 NMHDR hdr; 118 SYSTEMTIME SystemTime; 119 } NMMCCAUTOUPDATE, *PNMMCCAUTOUPDATE; 120 121 BOOL RegisterMonthCalControl(IN HINSTANCE hInstance); 122 VOID UnregisterMonthCalControl(IN HINSTANCE hInstance); 123 124 #endif /* _TIMEDATE_H */ 125