I forgot to add that i'm trying to do this as a service, it complains on seeing Application.SetSuspendState(PowerState.Hibernate, True, True) so i commented it out and added a timer to see if calc.exe was called, but it wasn't
it says the service is running which is great but running nothing !
Public Class Service1
Protected Overrides Sub OnStart(ByVal args() As String)
Timer1.Enabled = True
Timer1.Interval = 10000
Timer2.Enabled = True
Timer2.Interval = 30000
' Add code here to start your service. This method should set things
' in motion so your service can do its work.
End Sub
Protected Overrides Sub OnStop()
Timer1.Enabled = False
' Add code here to perform any tear-down necessary to stop your service.
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim MyLog As New EventLog() ' create a new event log
' Check if the the Event Log Exists
If Not MyLog.SourceExists("int") Then
MyLog.CreateEventSource("int", "Myservice Log")
' Create Log
End If
MyLog.Source = "int"
' Write to the Log
MyLog.WriteEntry("int Log", "This is log on " & _
CStr(TimeOfDay), _
EventLogEntryType.Information)
' Application.SetSuspendState(PowerState.Hibernate, True, True)
End Sub
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
call ("c:\windows\system32\calc.exe")
End Sub
End Class