Re: Silent Crash
- Posted by Pete Lomax <petelomax at blueyonder.co.uk> Nov 06, 2003
- 514 views
On Thu, 6 Nov 2003 14:57:59 -0000, Pete Stoner <pete.stoner at BTConnect.com> wrote: > My potential problem is if my program crashes - since there seems to be >no way of getting a 'Silent' crash without the console msg as far as windose >(and my monitor program) is concerned the failed program is still running >(although 'not responding'). Hi Pete The following should kill the debug window pretty sharpish (which could be a bit annoying if you leave this running and try to do any development . You can probably merge this with your monitor program, rather than having to start/leave three programs running. Regards, Pete include win32lib.ew constant Main = create(Window,"",0,0,0,0,0,0) constant KEYEVENTF_KEYUP = #02 atom user32, xkeybd_event, initKB initKB=0 procedure keybd(integer character) -- simulate a key press (and release!). -- character may be literal or a virtual key (eg VK_HOME) if not initKB then user32=open_dll("user32.dll") xkeybd_event = define_c_proc(user32, "keybd_event",{C_LONG,C_LONG,C_LONG,C_LONG}) initKB=1 end if c_proc(xkeybd_event,{character,0,0,0}) c_proc(xkeybd_event,{character,0,KEYEVENTF_KEYUP,0}) end procedure include window.ew -- Thomas Parslow's window finding functions procedure MainActTimerClose(integer self, integer event, sequence params) object hWnd if self or length(params) then end if -- suppress warnings if event=w32HActivate then setVisible(Main,False) setTimer(Main,1,40) -- 25 times a second (less may be better?) elsif event=w32HTimer then hWnd=window_GetCurrentWindow() if equal(window_GetCaption(hWnd),"EXW") then -- debug window_PostCloseMessage(hWnd) keybd('Y') end if elsif event=w32HClose then killTimer(Main,1) end if end procedure setHandler(Main,{w32HActivate,w32HClose,w32HTimer},routine_id("MainActTimerClose")) WinMain( Main, Normal )