Display System Time running real time

Hi

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.
0
aloha826 (28)
12/5/2008 12:58:24 AM
vc.mfc 33608 articles. 0 followers. Follow

3 Replies
634 Views

Similar Articles

[PageSpeed] 39

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@gmail.com" <aloha826@gmail.com> wrote:

>Hi
>
>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.
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15974)
12/5/2008 2:09:37 AM
Thanks. Issue resolved.

On Dec 5, 10:09=A0am, Joseph M. Newcomer <newco...@flounder.com> wrote:
> CTime t;
> t.GetCurrentTime();
> CString s =3D t.Format(_T("%H:%M:%S etc..."));
> CString old;
> c_TimeDisplay.GetWindowText(old);
> if(old !=3D s)
> =A0 =A0c_TimeDisplay.SetWindowText(s);
>
> put this in an OnTimer handler with a 1sec timer interval.
>
> Note that this is not locale-sensitive. =A0To create code that handles lo=
cale-sensitive
> display, take a look at my Locale Explorer. =A0If you don't care, you can=
 figure out the
> display options by using my CTime Explorer. =A0These can all be downloade=
d from my MVP Tips
> site.
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 joe
>
>
>
> On Thu, 4 Dec 2008 16:58:24 -0800 (PST), "aloha...@gmail.com" <aloha...@g=
mail.com> wrote:
> >Hi
>
> >how to display the system date time running real time in Dialog,
> >including seconds ?
>
> >I know declaring like:
> > =A0 =A0 SYSTEMTIME systime;
> > =A0 =A0 ZeroMemory(&systime,sizeof(SYSTEMTIME));
> > =A0 =A0 GetSystemTime(&systime); =A0 =A0 =A0 // gets current time
>
> > =A0 =A0 =A0 =A0 then access the SYSTEMTIME structure:
>
> >typedef struct _SYSTEMTIME {
> > =A0 WORD wYear;
> > =A0 WORD wMonth;
> > =A0 WORD wDayOfWeek;
> > =A0 WORD wDay;
> > =A0 WORD wHour;
> > =A0 WORD wMinute;
> > =A0 WORD wSecond;
> > =A0 WORD wMilliseconds;
> >} SYSTEMTIME;
>
> >but how to get it running in realtime as it elapses seconds by seconds
> >like
>
> > =A0 =A0 8:56:01 AM =A0 =A0 Monday, December 02, 2008
> > =A0...then
> > =A0 =A0 8:56:02 AM =A0 =A0 Monday, December 02, 2008
> > =A0...then
> > =A0 =A0 8:56:03 AM =A0 =A0 Monday, December 02, 2008
>
> >Regards.
>
> Joseph M. Newcomer [MVP]
> email: newco...@flounder.com
> Web:http://www.flounder.com
> MVP Tips:http://www.flounder.com/mvp_tips.htm

0
aloha826 (28)
12/5/2008 5:57:13 AM
Here is a link to setting up the date time on the status bar.  It's just a 
string so you could really put anything there.  I prefer using CTime as Joe 
illustrated to using _strtime(), but you may find something interesting 
here.   This example is only updating every minute, but you could change the 
resolution.  The OnTimer() routine would be the same in a dialog, you'd just 
update a static field on the dialog rather than the status bar.

http://www.codeproject.com/KB/statusbar/statusbar.aspx

Tom

<aloha826@gmail.com> wrote in message 
news:d82ea144-ca7d-4be5-a929-fd4f2183c2ad@l33g2000pri.googlegroups.com...
> Hi
>
> 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. 

0
tom.nospam (3240)
12/5/2008 6:14:59 AM
Reply:

Similar Artilces:

system tray new mail icon gone :(
Before i used to have an icon pop up in my system tray when i received a new mail. I accidently hid it one time and it no longer comes back. How can i get it back. I run Outlook Xp on a Win XP pro machine. Thanks in advance.. --minnoce944 Check Tools, Options, Email Options, Advanced Email Options. MAke sure the checkbox for "show an envelope in the notification area" is checked. If it is, right click on the Windows taskbar. Choose Properties, then customize. Your icon might have just been set to always hide. If so, you can change it to always show. -- Patricia Cardoza Outlook...

System.UnauthorizedAccessException on deserialization
This is also posted in the security newsgroup. Sorry for cross-posting, but I'm desperate. I have a Winforms application in VB.NET with a SQL Server (MSDE) backend. In the root application directory I have an XML file, LicXML.XML which holds licensing info for the app. On one group of machines where the users have restricted privileges, the deserialization of this file trips an error as follows (excuse mispellings from my client): My Client Writes: An error box with a "5" in the left end of the blue top bar appears, "System.UnauthorizedAccessException: Access to t...

Display As = File as & (address in parens)
I just moved all my contacts into a new .pst file (I'm using OL 2003) and something changed. I USED TO have "Display As" show only the person's name, and not the person's name PLUS the email address in parens as the default does. In other words, default would show "JOHN SMITH (johnsmith@aol.com)". But when I created all those entries, I changed them to show only "JOHN SMITH". In my new file, Outlook has changed all my "Display As" entries to the default: name AND email address. It's not how I want it, so I'm hoping there'...

Money 2006 Investment Account balance display
I have two Investment Accounts (401k) in Money 2006 Deluxe. For some reason, Money stopped displaying the account totals on the Account List page. It used to show the account balances and the subtotal for all of my investment accounts. Additionally, I now notice that each account now has a second account with the same name, but has the word "Contributions" added in parenthesis. This seems to be new as well. The data in the accounts still seems alright. My investment subtotal on the Account list page shows a zero balance and there is no balance listed for the accounts the...

Auto Calculate Monthly Time Pace
I need to show how far into a month we are at any given time in % form. I want this to change every day automatically. Example: Today is day 27 of 31 days in January - 87% if today was 2/17/10 it would need to show 17/28 or 61%, 12/20/10 would be 20/31 or 65%, and so on for each day throughout 2010 (12/20/10 would be 65%) Is there a formula or function to do this? Thanks! Heather "HeatherJ" wrote: > I need to show how far into a month we are at any given time in % form. [....] > Today is day 27 of 31 days in January - 87% One way: =day(today()) / ...

Running Office 2001 on Mac OS 10.2, help
This might be a dumb question, but I don't want to screw things up. I was running Mac OS 9.0.4 and I downloaded OS 9.1, 9.1.2, 9.2.2 and then the new 10.2. However, all my software is still in the 9.1 classic. I want to use it all in the new OS 10.2. Will Office 2001 Academic Edition work in OS 10.2? Do I need to uninstall it in OS 9.1 first, then install it is OS 10.2? Or, can I just drag and drop it on the 10.2 desktop or in the applications folder? I have a lot of other expensive softwares in OS 9.1 that I don't want to have to upgrade, but need to be able to use in OS 10.2. Wi...

I can't run My outlook 2007 as its capacity is exceeded. How can .
My outlook 2007 has exceeded is maximum capacity two days ago and since then I can't run it since I am always getting a system comment saying that I need to empty folders to have it back - which I did inquite a large number os them. Now I would like to know how can I overcome this situation since, as I said, I have emptied quite a lot of folders and no result was obtainesd so far. Kindly help me with your advices. the soonest if possible Thanks Graça Maria Portugal There is no such thing as Maximum Capacity in outlook. How many emails a day do you receive? ...

What is the best procedure for Getting a valid COA/License for a XP SP1 system.
I need to find out the best procedure for Getting a valid COA/License for a XP SP1 system. I've checked E-Bay but maybe dealing directly with M/S would be best Bob Robert J. Stevens wrote: > I need to find out the best procedure for Getting a valid > COA/License for a XP SP1 system. > I've checked E-Bay but maybe dealing directly with M/S would be best Not sure you can, anymore - for Windows XP. Assuming you are doing this because it is counterfeit/bad... http://www.microsoft.com/genuine/ -- Shenan Stanley MS-MVP -- How To Ask Questions The Smart ...

Media players opens and keeps trying to refresh about 5 times a mi
I have done numerous spyware chaecks all showing nothing detected I have eliminated any options in the media player that would have it trying to check for updates or web items. Completely at a loss and extremely unhappy the microsoft site does not have an answer. Acer Exyenza Laptop with Win XP , Office 07 and player 11 any help guys? in the time in took to type this meassage the player popped up three times Try disabling (unchecking) all active WMP plug-ins in WMP's Options. If you download and run Process Explorer - http://technet.microsoft.com/en-us/sysinternals/bb8...

Run-time error '381' Invalid property array index
Dear All, I am using RMS 2.0, In POS i set security (disable read) on all columns of setting Customer window. But i got this error when i press F7: Run-time error '381' Invalid property array index. Any kind of help will be highly appreciated. Ibrahim Zubair I get the same message when I try to reprint a receipt did you find the answer to this problem? "Ibrahim Zubair" wrote: > Dear All, > > I am using RMS 2.0, In POS i set security (disable read) on all columns of > setting Customer window. But i got this error when i press F7: > Run-time error '...

>>>Notice of Delayed Response Times<<<<
------=_NextPart_0001_48190A22 Content-Type: text/plain Content-Transfer-Encoding: 7bit Dear partners, Thank you for your patience during our recent service delays due to flooding in the Fargo area. We apologize for any inconvenience this may have caused and are working diligently to restore the service level you have become accustomed to receive with this service. We appreciate your patience as we work through posts and inquiries in the order they were received. Thank you for participating in the partner online technical communities! Jen Mehrer Microsoft Partner Newsgroups Suppo...

time formulas
Can anybody give me an advice Lets say i put in first column dime of departure and in second one time of arrival (of course i know have to insert the time ). In third column i get the time spent somwhere. So far everything is ok. The problem occ urs when i want the sum of all differences in the third column (rows are months dates). The autosumm formula wont work and the result is completely wrong. thanks miro Hi format the resulting cell with the custome format [hh]:mm -- Regards Frank Kabel Frankfurt, Germany axiom wrote: > Can anybody give me an advice > > Lets say i put i...

Outlook 2000
I'm having a strange Outlook issue and cannot figure it out for the life of me. Our mail server is Exchange 5.5 (can't recall the SP right now), and the Client is Outlook 2000 SR-1. The user can view his primary email box without any troubles, but also has access to another Exchange email box. He can view every folder in it except the Sent Items. The error it returns is "Unable to display the folder". What's strange is he can view the subfolder in Sent Items, no problem. I've configured his email on a different PC, and everything shows up fine, so I know ...

How to know which mfc.dlls are needed to run my app
When I build a .exe using MFC, it won't run unless it can access the proper .dlls (mfc32d.dll, etc.). How can I find which .dlls I need to include when I want to install my software on another computer? First of all, if your application is complaining about a missing mfc DLL that has a "d" on the end of the name then you need to rebuild your application using the Release build. The debug DLLs are not, nor should they be, redistributable. Next, you can run the depends.exe utility to identify what DLLs your application requires. It will show you ALL the DLLs that are needed to...

finding all addresses in an exchange system
Being relatively new to Exchange and Outlook, I'm looking for the best way to implement a situation where there is a generic email account that the outside world sends to that a number of people need to monitor. Right now what I have done is set up an email enabled Public Folder and simply give permissions to that folder to the appropriate people. I also hide that address so it doesn't display in the GAL, since there is no reason for internal folks to write to that address. However, one problem I see with this scenario is I can't find an effective way to look at all email addres...

number in system using arrivals and departures
Is there and easy way to figure out the total number of persons in a system if have access to the arrival and departure times. I have tried to use counts with if statements, but I keep getting the number 1. I know this is not correct. Is there any special macros or functions Thanks Hi you may provide some more details about your data. Could you post some example rows (plain text - no attachments please) and describe your expecte result -- Regards Frank Kabel Frankfurt, Germany megv wrote: > Is there and easy way to figure out the total number of persons in a > system if have access...

Creating timelines that don't use time as the horizontal measureme
Is it possible to use the timeline functionality of visio without using time as the horizontal meter? I want to have the same functionality of a timeline, but use it to express events that happen over a range of values from 0-100. ...

System Attendant Mailbox #3
Hello, I just installed a Exchange 5.5 Sp4 server on w2k maschine. But I don't see my System Attendant Mailbox even if I receive mails from it. Could someone say me what is wrong? Thanks a lot for any help. Mitsi Where are you looking to view the system attendant mailbox? If you haven't tried look in mailbox resources and it should be there. -- Tyrone Cowart Microsoft PSS Please do not send email directly to this alias. This alias is for newsgroup purposes only. This posting is provided "AS IS" with no warranties, and confers no rights. "mitsi" <anonymous...

Embedded Pictures received from Others do not display in outlook.
I recently switched to Outlook from Outlook Express. When e-mails are received with embedded pictures, they display properly in Outlook Express but do not display at all in Outlook. Is this related to a security setting in Outlook that I can change to allow these pictures to be displayed? PLEASE HELP!!!! Jim <Jim@discussions.microsoft.com> wrote: > I recently switched to Outlook from Outlook Express. When e-mails are > received with embedded pictures, they display properly in Outlook > Express but do not display at all in Outlook. > > Is this related to a securi...

Conditional Statements and Time Format
Hello, I have a spreadsheet where I need to calculate a range of time in a cell and display a value in another cell. Example is in cell F2 I have a time displayed of 15:34, and in the calculation window it displays as 3:34:00 PM. In Cell F3 I want to display one of three things, "1st shift", "2nd shift" or "3rd shift". Is it possible to use the conditional statements to give me the value of "1st shift" when cell F2 is between >= 07:00 and < 15:00? I can't find anything that speaks to getting thee range information from time. Thanks, Brian ...

Time conversion problem
I am trying to write some data analysis macro code and am having problems with how Excel is and isn't storing the times. During a study a researcher enters, for example 4:39. That needs to be 4 minutes and 39 seconds. However, Excel formats it as 4 hours and 39 minutes - as "h:mm". I really want it formatted as "hh:mm:ss" so it would be 00:04:39. If I go in and change the cell format to "hh:mm:ss" it simply writes the value out as 4:39:00. I've tried switching back and forth between various date, general, and text formats to no avail. For a number of reas...

Automatic date/time aquisition for graphs
Ok, I collect particle count data for a cleanroom which looks like th following: "LASAIR110","04/05/19","15:47:41",2700.0,45.00,"V6.3",0,0,0,1,433,486,236,113,294,196,103,328,4.993,1.0000,0.000,0.000,0.000,0.000,0.000,"22de" "LASAIR110","04/05/19","16:33:15",2700.0,45.00,"V6.3",0,0,0,1,458,432,163,55,107,55,46,139,5.007,1.0000,0.000,0.000,0.000,0.000,0.000,2299 "LASAIR110","04/05/19","17:18:49",2700.0,45.00,"V6.3",0,0,0,1,305,286,76,29,14,1,0,0,5.017,1.0000,0.000...

"Display Map of Address" not working...
Hi - noticed this on two machines, one XP and the other WIN2K, both running Outlook 2003. When I click on "Display Map of Address" for a contact, a browser window opens, but it cannot connect to the web site it uses, which i believe is expedia maps; so the page is just empty. I've used this feature a lot in the past without problems, and have never had mappoint installed on either machine. I also found this problem when trying two separate browsers as the default. Given that i'm seeing the issue on two separate machines, thinking it's some sort of more global issue...

Exchange 5.5 System Free/Busy objects left in Exchange 2003 since Migration.
Hi I hope somebody can help with this. I migrated our old Exchange 5.5 Org to Exchange 2003 last year and followed all the MS KB's about doing this. Since then we have switched to Native Mode 2003 and working fine. However we found that our AD infrastructure wasn't at its best and are currently deploying a new Domain. Now this is where the fun starts. While creating a new Exchange 2003 Org in the new Domain, we are replicating the Public/System Folders from the old Org and we have been getting some errors. On investigation we have found that there are redundant Free/Busy Schedule+ obj...

Multiple display names for one user?
This is a multi-part message in MIME format. ------=_NextPart_000_0008_01C42D19.8EED3880 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Is this possible? We have a few people that I like to call "special" = who seem to have some identity problems. These people have a first = name, middle name and a nick name. Well they don't like the fact that = their email shows up as their legal name, but they still want it there = incase people use it. So what we have ended up doing is creating = multiple logins and email accounts th...