开发者

Subscribe to event of changing time on local system

Is there a way to my C# winforms application knows when Date and time s开发者_JS百科ettings has changed on local computer.


Yes, you want to take a look at SystemEvents.TimeChanged.

Microsoft.Win32.SystemEvents.TimeChanged += 
    new EventHandler(SystemEvents_TimeChanged);

void SystemEvents_TimeChanged(object sender, EventArgs e)
{
    // The system time was changed
}

From the documentation:

Occurs when the user changes the time on the system clock.


I think SystemEvents.TimeChanged is what you are looking for.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜