2005-05-07 21:24:31 +00:00
|
|
|
/* $Id$
|
2004-10-21 05:12:02 +00:00
|
|
|
*
|
|
|
|
* DESCRIPTION: Simple Win32 Caption Clock
|
|
|
|
* PROJECT : ReactOS (test applications)
|
|
|
|
* AUTHOR : Emanuele Aliberti
|
|
|
|
* DATE : 2003-09-03
|
|
|
|
* LICENSE : GNU GPL v2.0
|
|
|
|
*/
|
|
|
|
#include <windows.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
UINT Timer = 1;
|
|
|
|
|
2010-06-03 20:08:26 +00:00
|
|
|
static INT_PTR CALLBACK DialogFunc(HWND,UINT,WPARAM,LPARAM);
|
|
|
|
static VOID CALLBACK TimerProc(HWND,UINT,UINT_PTR,DWORD);
|
2004-10-21 05:12:02 +00:00
|
|
|
|
|
|
|
|
2008-11-29 21:37:54 +00:00
|
|
|
INT WINAPI WinMain (HINSTANCE hinst, HINSTANCE hinstPrev, LPSTR lpCmdLine, INT nCmdShow)
|
2004-10-21 05:12:02 +00:00
|
|
|
{
|
|
|
|
WNDCLASS wc;
|
|
|
|
|
|
|
|
ZeroMemory (& wc, sizeof wc);
|
|
|
|
wc.lpfnWndProc = DefDlgProc;
|
|
|
|
wc.cbWndExtra = DLGWINDOWEXTRA;
|
|
|
|
wc.hInstance = hinst;
|
|
|
|
wc.hCursor = LoadCursor(NULL, (LPCTSTR)IDC_ARROW);
|
|
|
|
wc.hbrBackground = (HBRUSH) (COLOR_WINDOW + 1);
|
|
|
|
wc.lpszClassName = "CapClock";
|
|
|
|
RegisterClass (& wc);
|
|
|
|
return DialogBox(hinst, MAKEINTRESOURCE(2), NULL, DialogFunc);
|
|
|
|
|
|
|
|
}
|
|
|
|
static int InitializeApp (HWND hDlg,WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
|
|
|
Timer = SetTimer (hDlg,Timer,1000,TimerProc);
|
|
|
|
TimerProc (hDlg,0,0,0);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
static INT_PTR CALLBACK DialogFunc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
|
|
|
switch (msg)
|
|
|
|
{
|
|
|
|
case WM_INITDIALOG:
|
|
|
|
InitializeApp(hwndDlg,wParam,lParam);
|
|
|
|
return TRUE;
|
|
|
|
case WM_CLOSE:
|
|
|
|
KillTimer (hwndDlg,Timer);
|
|
|
|
EndDialog(hwndDlg,0);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
2010-06-03 20:08:26 +00:00
|
|
|
static VOID CALLBACK TimerProc (HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
|
2004-10-21 05:12:02 +00:00
|
|
|
{
|
|
|
|
CHAR text [20];
|
|
|
|
SYSTEMTIME lt;
|
|
|
|
|
|
|
|
GetLocalTime (& lt);
|
|
|
|
wsprintf (
|
|
|
|
text,
|
|
|
|
"%d-%02d-%02d %02d:%02d:%02d",
|
|
|
|
lt.wYear,
|
|
|
|
lt.wMonth,
|
|
|
|
lt.wDay,
|
|
|
|
lt.wHour,
|
|
|
|
lt.wMinute,
|
|
|
|
lt.wSecond);
|
|
|
|
SetWindowText (hwnd, text);
|
|
|
|
}
|
|
|
|
/* EOF */
|