Re: Silent Crash

new topic     » goto parent     » topic index » view thread      » older message » newer message

Thanks Pete, I made some minor modifications as I found I couldn't rely on the
debug
window coming to the foreground..(and the timer was a bit faster than I needed!)
But it
works great now.. 
Hopefully(!?) this 'crash' routine will not be needed but I like to cover all
eventualities!!
I may also add a time check so if the crash happens again too soon I'll force a
reboot..

procedure onTimer_PMHCheck( integer self, integer event, sequence params)
atom ret
object hWnd, Caption
if self or length(params) then end if	-- suppress warnings
if event = w32HActivate then
    setTimer( Monitor_Win, Monitor_Timer, 10000 )

elsif event = w32HTimer then
    if not ipc_IsProcessRunning("CallGenerator") then
UpdateLog( "Call Generator program has Closed down... restarted by
        automatic
		   monitor")
        shellExecute("open", "Call Generator.exe", SW_SHOWNORMAL) 
        sleep(5)
        ipc_CallProc("CallGenerator","StartGenerator",{})	-- press start button

    elsif window_Exists("*\\Call Generator.exe") then
        window_PostCloseMessage(window_GetHwnd("*\\Call Generator.exe"))
        keybd('Y')
UpdateLog("Call Generator program has crashed... closed down by
        automatic
			   monitor")
    end if
	
elsif event=w32HClose then
	killTimer(Monitor_Timer,1)
end if
end procedure
setHandler(Monitor_Win,{w32HActivate, w32HClose, 
w32HTimer},routine_id("onTimer_PMHCheck"))

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu