|
-
Aug 8th, 2000, 08:23 PM
#1
Thread Starter
Addicted Member
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??
-
Aug 8th, 2000, 11:13 PM
#2
Fanatic Member
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]
-
Aug 20th, 2000, 10:58 AM
#3
New Member
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~
-
Aug 20th, 2000, 11:08 AM
#4
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
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
|