How do I close a window which is running a DOS-based program?
I used 'SHELL' to run a program (ex. PKZIP) but it doesn't allow me to get the window handle so I couldn't close it. Can you guys give me some ideas on how to do this? Thanks a lot!
Printable View
How do I close a window which is running a DOS-based program?
I used 'SHELL' to run a program (ex. PKZIP) but it doesn't allow me to get the window handle so I couldn't close it. Can you guys give me some ideas on how to do this? Thanks a lot!
Public Sub close_remote_window()
Dim winTitle As String, hwnd As Long
Const NILL = 0&
Const WM_SYSCOMMAND = &H112
Const SC_CLOSE = &HF060&
'Change winTitle to the title of the window you want to shut.
'example: winTitle = "Untitled - Notepad"
hwnd = FindWindow(vbNullString, winTITLE)
If hwnd <> 0 Then
hwnd = SendMessage(hwnd, WM_SYSCOMMAND, SC_CLOSE, NILL)
End If
End Sub
if you will ever find out how to OPEN(Resize) a dos window in to its full size mode..
that will be great.
I'm new to api's .. but if u can reference the window for the dos window, can u not send it commands like alt-enter ? that would fullscreen any app. :p don't flame me, cause i'm just guessing ;)