-
Lets say that I`m running internet explorer (or any other program for that matter) and I want to have a button on my visual basic program to close it. Any idea how?
I tried using (sendmessage and WM_DESTROY) but it makes the program freeze...
Any one have an idea??
-
How about sending WM_CLOSE first and after that WM_DESTROY? (or DESTROY-CLOSE I forgot which one it is)
Or use CloseWindow API
Code:
Public Declare Function CloseWindow Lib "user32" Alias "CloseWindow" (ByVal hwnd As Long) As Long
Post #517
[Edited by QWERTY on 08-09-2000 at 12:33 AM]
-
Closing Application
I also had a problem killing applications, particularly Internet Explorer with the SendMessage.
What I used instead was the PostMessage.
if this is some help
Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
G Luck
~Q~
-
Try this:
Code:
Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Declare Function DestroyWindow Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Const WM_CLOSE = &H10
Private Sub Command1_Click()
Dim hApp As Long
hApp = FindWindow("IEFrame", vbNullString)
PostMessage hApp, WM_CLOSE, 0, 0
DestroyWindow hApp
End Sub