ReactOS  r75907
capclock.c
Go to the documentation of this file.
1 /*
2  * DESCRIPTION: Simple Win32 Caption Clock
3  * PROJECT : ReactOS (test applications)
4  * AUTHOR : Emanuele Aliberti
5  * DATE : 2003-09-03
6  * LICENSE : GNU GPL v2.0
7  */
8 #include <windows.h>
9 #include <string.h>
10 
11 UINT Timer = 1;
12 
15 
16 
17 INT WINAPI WinMain (HINSTANCE hinst, HINSTANCE hinstPrev, LPSTR lpCmdLine, INT nCmdShow)
18 {
19  WNDCLASS wc;
20 
21  ZeroMemory (& wc, sizeof wc);
24  wc.hInstance = hinst;
26  wc.hbrBackground = (HBRUSH) (COLOR_WINDOW + 1);
27  wc.lpszClassName = "CapClock";
28  RegisterClass (& wc);
29  return DialogBox(hinst, MAKEINTRESOURCE(2), NULL, DialogFunc);
30 
31 }
33 {
34  Timer = SetTimer (hDlg,Timer,1000,TimerProc);
35  TimerProc (hDlg,0,0,0);
36  return 1;
37 }
39 {
40  switch (msg)
41  {
42  case WM_INITDIALOG:
43  InitializeApp(hwndDlg,wParam,lParam);
44  return TRUE;
45  case WM_CLOSE:
46  KillTimer (hwndDlg,Timer);
47  EndDialog(hwndDlg,0);
48  return TRUE;
49  }
50  return FALSE;
51 }
53 {
54  CHAR text [20];
55  SYSTEMTIME lt;
56 
57  GetLocalTime (& lt);
58  wsprintf (
59  text,
60  "%d-%02d-%02d %02d:%02d:%02d",
61  lt.wYear,
62  lt.wMonth,
63  lt.wDay,
64  lt.wHour,
65  lt.wMinute,
66  lt.wSecond);
67  SetWindowText (hwnd, text);
68 }
69 /* EOF */
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define TRUE
Definition: types.h:120
const CHAR * LPCTSTR
Definition: xmlstorage.h:193
USHORT wMonth
Definition: rtltypes.h:1568
char CHAR
Definition: xmlstorage.h:175
static VOID CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD)
Definition: capclock.c:52
#define CALLBACK
Definition: compat.h:27
UINT uMsg
Definition: precomp.h:53
HANDLE HWND
Definition: compat.h:13
#define ZeroMemory
Definition: winbase.h:1621
INT WINAPI WinMain(HINSTANCE hinst, HINSTANCE hinstPrev, LPSTR lpCmdLine, INT nCmdShow)
Definition: capclock.c:17
HBRUSH hbrBackground
Definition: winuser.h:3113
int32_t INT_PTR
Definition: typedefs.h:63
char * LPSTR
Definition: xmlstorage.h:182
#define COLOR_WINDOW
Definition: winuser.h:898
int32_t INT
Definition: typedefs.h:57
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
DWORD DWORD
Definition: winlogon.h:75
UINT_PTR WPARAM
Definition: windef.h:230
#define DialogBox
Definition: winuser.h:5606
USHORT wYear
Definition: rtltypes.h:1567
int cbWndExtra
Definition: winuser.h:3109
#define FALSE
Definition: types.h:117
LONG_PTR LPARAM
Definition: windef.h:231
static const IUnknown void **static void **static RGBQUAD *static HINSTANCE hinst
Definition: imagelist.c:73
HCURSOR hCursor
Definition: winuser.h:3112
USHORT wMinute
Definition: rtltypes.h:1572
smooth NULL
Definition: ftsmooth.c:513
VOID WINAPI GetLocalTime(OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:276
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
DWORD dwTime
Definition: solitaire.cpp:25
UINT WPARAM wParam
Definition: precomp.h:53
#define WM_CLOSE
Definition: winuser.h:1593
static int InitializeApp(HWND hDlg, WPARAM wParam, LPARAM lParam)
Definition: capclock.c:32
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
USHORT wSecond
Definition: rtltypes.h:1573
HANDLE HINSTANCE
Definition: typedefs.h:76
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
#define DLGWINDOWEXTRA
Definition: winuser.h:2509
static INT_PTR CALLBACK DialogFunc(HWND, UINT, WPARAM, LPARAM)
Definition: capclock.c:38
LPCSTR lpszClassName
Definition: winuser.h:3115
#define WINAPI
Definition: msvc.h:20
#define LoadCursor
Definition: winuser.h:5657
#define DefDlgProc
Definition: ros2win.h:34
USHORT wDay
Definition: rtltypes.h:1570
HINSTANCE hInstance
Definition: winuser.h:3110
USHORT wHour
Definition: rtltypes.h:1571
UINT WPARAM LPARAM lParam
Definition: precomp.h:53
#define SetWindowText
Definition: winuser.h:5702
unsigned int UINT
Definition: ndis.h:50
WNDPROC lpfnWndProc
Definition: winuser.h:3107
#define IDC_ARROW
Definition: winuser.h:682
LPCSTR text
Definition: menu.c:130
UINT msg
Definition: msvc.h:92
#define RegisterClass
Definition: winuser.h:5681
#define wsprintf
Definition: winuser.h:5710
#define WM_INITDIALOG
Definition: winuser.h:1705