|
-
Nov 3rd, 2000, 06:48 AM
#1
Thread Starter
New Member
How do i close an application started with shell command
-
Nov 3rd, 2000, 06:54 AM
#2
Lively Member
I came accross this before but unfortunately I can't remember the exact syntax.
You need to use an API (possibly SetWindowPos, I can't remember) to set the window size to 0,0. This closes the window and therefore ends the application.
I couldn't find a more direct way of doing it.
Good luck.
Best regards,
Rob Brown.
-
Nov 3rd, 2000, 07:07 AM
#3
_______
<?>
Code:
Private Declare Function FindWindowEx Lib "user32" _
Alias "FindWindowExA" (ByVal hWnd1 As Long, _
ByVal hWnd2 As Long, ByVal lpsz1 As String, _
ByVal lpsz2 As String) As Long
Private Declare Function SendMessage Lib "user32" Alias _
"SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, _
ByVal wParam As Long, lParam As Any) As Long
Private Declare Function DestroyWindow Lib "user32" _
(ByVal hwnd As Long) As Long
Private Const WM_CLOSE = &H10
Private Sub Command1_Click()
Dim hApp As Long
hApp = FindWindowEx(0&, 0&, vbNullString, "Notepad")
If hApp <> 0 Then
SendMessage hApp, WM_CLOSE, 0, 0
DestroyWindow hApp
End If
End Sub
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|