Search code examples
c#timewindows-cesystemevent

SystemEvents.TimeChanged is not in Windows CE 6.0?


My C# application will run in both windows 7 and windows CE 6.0,

I need to do some operation while change the time so i used below event in windows 7,

SystemEvents.TimeChanged += new EventHandler(SystemEvents_TimeChanged); 

its perfectly working in windows 7

but this is not working in the windows CE, SystemEvents namespace not in the CE.

any one tell how to use this event in windows CE.

Thanks,


Solution

  • You can receive a NOTIFICATION_EVENT_TIME_CHANGE notification if you P/Invoke CeRunAppAtEvent - see http://bytes.com/topic/net/answers/652128-how-detect-system-time-change-compactframework.

    Hans Passant's comment (listening for a WM_TIMECHANGE event) could be an even more straightforward approach, although this also requires some P/Invoking in the compact framework.