Protected Overrides Sub OnStart(ByVal args() As String) AddHandler SystemEvents.TimeChanged, AddressOf SystemEvents_TimeChanged End Sub Private Sub SystemEvents_TimeChanged(ByVal sender As Object, ByVal e As EventArgs) WriteToFile("System Time has been changed") End Sub
SystemEvents.TimeChanged Event (Microsoft.Win32)[^]: Note This event is only raised if the message pump is running. In a Windows service, unless a hidden form is used or the message pump has been started manually, this event will not be raised. For a code example that shows how to handle system events by using a hidden form in a Windows service, see the SystemEvents class[^].
SystemEvents
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)