|
-
Sep 29th, 2003, 08:18 PM
#1
Thread Starter
New Member
Close an application that was started using shellexecute
i wish to close another program that was started by using the shell execute. i looked at send message and postmessage API's but it doesnt seem to work. I have attached sample code below. an help that you can provide will be greately appriciated.
thanks
Option Explicit
'Private Declare Function GetForegroundWindow Lib "user32" () As Long
Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) 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 ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Const WM_CLOSE = &H10
Private Sub Command1_Click()
tHwnd = ShellExecute(Me.hwnd, vbNullString, "c:\temp.jpg", vbNullString, "C:\", 1)
End Sub
Private Sub Command2_Click()
PostMessage tHwnd, WM_CLOSE, 0, 0
'i have also tried this
SendMessage tHwnd, WM_CLOSE, 0, 0
End Sub
both the functions dont work. please help.
thanks once again
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
|