Hey Nick,
Have you looked at Ed's API_APPRUN files? If you launch a DOS EXE using it, it's really easy to manage and kill. I use this extensively.
>What is the right way to get rid of (close, destroy, kill, whatever) the application running in DOS window (under Windows NT) from VFP?
>
>VFP monitor app runs the instance of FoxPro DOS application. FoxPro DOS is in a constant DO WHILE loop.
>At some point my VFP monitor app decides that it does not need that FP DOS app instance running. The FP DOS app may hang or wait too long for the SQL SELECT statement result. I want to get rid of it. I know hWnd of this DOS window.
>
>I searched the previous threads and tried
>
>DECLARE INTEGER SendMessage IN WIN32API ;
> INTEGER hWnd, ;
> INTEGER Msg, ;
> INTEGER wParameter, ;
> INTEGER lParameter
> =SendMessage(lnhWnd, WM_CLOSE, 0, 0)
>
>That naturally waits a little and brings the Windows dialog "Windows cannot end this program... etc... End Now; Cancel.
>And I want to get rid of it immediately. I know there is TerminateProcess() API function, but I don't know how to properly use it in this case.
>
>Any hints? Or is there any other way?
------------------------------------------------
John Koziol, ex-MVP, ex-MS, ex-FoxTeam. Just call me "X"
"When the going gets weird, the weird turn pro" - Hunter Thompson (Gonzo) RIP 2/19/05