Search the Community
Showing results for tags 'shutdown restart'.
-
Hi all! I have a small problem that i cant figure out, its a program that connect to a management PC (for customer support, remote control) that i wrote.. Every time older computers (windowsXP, never on win7) or busy computers shutdown or restart i get an error message. Windows says that my apps made a error and a popup message apper asking user to close the apps. if it is a faster computer the message just blink and windows is shutting down the PC anyway. how can i add/issue a shutdown command if PC reboots? So no error message popup when windows tryes to close the app. here is the code Do If TimerDiff($iBegin) > 6000 Then ; Loop until 1 min have passed _DebugOut("_settings()") _settings() _DebugOut("_updatedatabase()") ; _updatedatabase() $iBegin = TimerInit() EndIf If TimerDiff($iBegin1) > 600000 Then ; until 10 min passed If ping($MySQLServer) Then _MySQLUpdateSoft() EndIf $iBegin1 = TimerInit() EndIf Sleep(10) ; just to keep the program running Until $oClient.connect("_Recv", "_Receiving", "_LostConnection", "_TimedOut") > 0 _DebugOut("Client connected!") While $running $oClient.Process() If TimerDiff($iBegin) > 6000 Then ; Loop until 6 min have passed _settings() ; _updatedatabase() $iBegin = TimerInit() EndIf If TimerDiff($iBegin1) > 600000 Then ; until 10 sec passed If $MySQLServer <> "0.0.0.0" Then _MySQLUpdateSoft() EndIf $iBegin1 = TimerInit() EndIf Sleep(10) ; just to keep the program running WEnd Func _Recv($data) _DebugOut("Recv: " & $data) $data = StringSplit($data, "|", 2) _DebugOut("Recv: " & @IPAddress1 & ": " & $data[0]) Switch $data[0] Case $data[0] = "End" $oClient.Send("OK, Ending communication! Restarting client") Exit Case $data[0] = "ping" $oClient.Send("pong")