Re: Display System Time running real time
- From: Joseph M. Newcomer <newcomer@xxxxxxxxxxxx>
- Date: Thu, 04 Dec 2008 21:09:37 -0500
CTime t;
t.GetCurrentTime();
CString s = t.Format(_T("%H:%M:%S etc..."));
CString old;
c_TimeDisplay.GetWindowText(old);
if(old != s)
c_TimeDisplay.SetWindowText(s);
put this in an OnTimer handler with a 1sec timer interval.
Note that this is not locale-sensitive. To create code that handles locale-sensitive
display, take a look at my Locale Explorer. If you don't care, you can figure out the
display options by using my CTime Explorer. These can all be downloaded from my MVP Tips
site.
joe
On Thu, 4 Dec 2008 16:58:24 -0800 (PST), "aloha826@xxxxxxxxx" <aloha826@xxxxxxxxx> wrote:
HiJoseph M. Newcomer [MVP]
how to display the system date time running real time in Dialog,
including seconds ?
I know declaring like:
SYSTEMTIME systime;
ZeroMemory(&systime,sizeof(SYSTEMTIME));
GetSystemTime(&systime); // gets current time
then access the SYSTEMTIME structure:
typedef struct _SYSTEMTIME {
WORD wYear;
WORD wMonth;
WORD wDayOfWeek;
WORD wDay;
WORD wHour;
WORD wMinute;
WORD wSecond;
WORD wMilliseconds;
} SYSTEMTIME;
but how to get it running in realtime as it elapses seconds by seconds
like
8:56:01 AM Monday, December 02, 2008
...then
8:56:02 AM Monday, December 02, 2008
...then
8:56:03 AM Monday, December 02, 2008
Regards.
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.
- Follow-Ups:
- Re: Display System Time running real time
- From: aloha826@xxxxxxxxx
- Re: Display System Time running real time
- References:
- Display System Time running real time
- From: aloha826@xxxxxxxxx
- Display System Time running real time
- Prev by Date: Re: add background image to SDI Application
- Next by Date: Re: wchar_t as a string parameter
- Previous by thread: Display System Time running real time
- Next by thread: Re: Display System Time running real time
- Index(es):
Relevant Pages
|