473,396 Members | 1,996 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Notified when system date has been changed.

My application displays today's date on the form like;
Friday August 4, 2006

This information is determined at the form's constructor. But what
about the user has kept the form shown so long that the next day comes
( in this case, Saturday August 5, 2006)? One simple way is to check
the today's date periodically and if the date has been changed, then
update the date on the form. But this seems to be a waste. If the
interval is short, then the program will waste too much CPU, and if the
interval is long, then the date won't be updated immediately.

So, is there any event like "SystemDateChanged"? I tried to find it but
failed. Or do I have to use Win32 API to get notified?

Thanks.

Aug 4 '06 #1
2 5971
Sin Jeong-hun wrote:
My application displays today's date on the form like;
Friday August 4, 2006

This information is determined at the form's constructor. But what
about the user has kept the form shown so long that the next day comes
( in this case, Saturday August 5, 2006)? One simple way is to check
the today's date periodically and if the date has been changed, then
update the date on the form. But this seems to be a waste. If the
interval is short, then the program will waste too much CPU, and if the
interval is long, then the date won't be updated immediately.

So, is there any event like "SystemDateChanged"? I tried to find it but
failed. Or do I have to use Win32 API to get notified?
There's nothing relevant in Microsoft.Win32.SystemEvents, and it looks
like this is just a wrapper around the various broadcast WM_ Windows
messages, and I don't see one of those for the date just naturally
ticking over.

Rather than polling the time every second to see if the date has
changed, you could maybe note the time on startup (eg 4 pm), and set
something that notifies you (in this case) 8 hours later. Though this
could get flummoxed by daylight savings time...
--
Larry Lard
la*******@googlemail.com
The address is real, but unread - please reply to the group
For VB and C# questions - tell us which version
Aug 4 '06 #2
You may be able to be notified of this change by using the following method:

protected override void WndProc(ref Message m)
{
System.Diagnostics.Debug.WriteLine(m);
base.WndProc(ref m);
}

I'm not sure what the exact message will be, but you should be see in the output window as you change the clock.

Hope this helps

Paul

"Sin Jeong-hun" <ty*******@gmail.comwrote in message news:11**********************@m73g2000cwd.googlegr oups.com...
My application displays today's date on the form like;
Friday August 4, 2006

This information is determined at the form's constructor. But what
about the user has kept the form shown so long that the next day comes
( in this case, Saturday August 5, 2006)? One simple way is to check
the today's date periodically and if the date has been changed, then
update the date on the form. But this seems to be a waste. If the
interval is short, then the program will waste too much CPU, and if the
interval is long, then the date won't be updated immediately.

So, is there any event like "SystemDateChanged"? I tried to find it but
failed. Or do I have to use Win32 API to get notified?

Thanks.
Aug 4 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: MLH | last post by:
I want to change my system time date each time an A97 app is started. Here's how I've been doing it. Am looking for a better way. Sure some of you have researched this. Function...
3
by: roger beniot | last post by:
I would like to figure out how to detect an IP address change for an XP/Win2K3 machine that is leasing an IP via DHCP (and do it in C#)... Is there any event that indicates an IP address...
6
by: Thomas Connolly | last post by:
I have 2 pages referencing the same codebehind file in my project. Originally the pages referenced separate code behind files. Once I changed the reference to the same file, everything worked...
1
by: TN Bella | last post by:
Hello, I was looking through the older posts for a solution to this problem, but I am still confused on how to fix my problem. There are two dates on my form, one (txtInvDate) is entered by the...
6
by: sylcheung | last post by:
Hi, How can I be notified when the document load is complet in JavaScript? I am referring to the whold document load is complete, mean all images/external files/frame/iframes have been loaded. ...
2
by: active | last post by:
I think I saw something once that made me think a program could get notified if a file changes. I'm not sure if the notification occurs if anything in the file system changes or if it is more...
1
by: PJ on Development | last post by:
Greetings, I'm developping a simple WinForm application and I'm kinda stuck. I need to be aware if the user changed the default system fonts (i.e. the fonts defined in the Control...
1
by: =?ISO-8859-1?Q?Lasse_V=E5gs=E6ther_Karlsen?= | last post by:
I get the above error in some of the ASP.NET web applications on a server, and I need some help figuring out how to deal with it. This is a rather long post, and I hope I have enough details that...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.