>Hi Ed,
>
>I had done the following, but the other application still does not exit. What
>did I miss out. Please advise.
>
>hWnd = FINDWINDOW(0,'Application caption to exit')
>TerminateProcess(hWnd,0)
>
FindWindow returns the hWnd of the Window, not the Process Handle of the application. You have to use SendMessage() to send a WM_CLOSE to the Window returned by FindWindow.
Under Windows, lots of things have handles; the handles are not interchangable. TerminateProcess() acts on a Process Handle, not something given back to you by FindWindow(). While there are ways of getting a process handle, it's not trivial code to write; you'd be better of using SendMessage(), since it invokes a shutdown by normal means; TerminateProcess() is a messy shutdown that can leave Windows in an unstable condition, and it should only be used to shut down things that stop responding to normal Windows messages.
There are examples in the Files and FAQ here on UT that show how to use SendMessage() to shut down an app based on the return from FindWindow.