#A NEW Shell Problem
07-Oct-91 11:35:50
Sb: #A NEW Shell Problem
Fm: Selden McCabe 75300,2244
To: Costas Kitsos 73667,1755
Costas,
This is a summary of what I've tried to do to terminate a shelled windows
application:
Here I start the program and get the window handle:
x% = Shell(commandline$, 3)
ShellWindowHWnd% = GetActiveWindow%()
Here the user chooses Quit, and I try to kill the shelled program if it is
still running:
'—try three different methods to kill the window
If IsWindow%(ShellWindowHWnd%) <> 0 Then
x% = DestroyWindow(ShellWindowHWnd%)
End If
If IsWindow%(ShellWindowHWnd%) <> 0 Then
x% = SendMessage(ShellWindowHWnd%, WM_SYSCOMMAND, SC_CLOSE, b)
End If
If IsWindow%(ShellWindowHWnd%) <> 0 Then
n% = PostMessage(ShellWindowWHnd%, WM_SYSCOMMAND, SC_RESTORE, 0)
x% = SetfocusAPI(ShellWindowHWnd%)
SendKeys "%{F4}", TRUE
End If
The SendMessage with WM_SYSCOMMAND SC_CLOSE seems to actually close some
programs, but causes others to hang the system. As far as I can tell, the
other methods ether do nothing, or simply iconize the running program.
Any further thoughts on this?
best regards, Selden
There are 3 Replies.