Hey Guys,
Does anyone know how to close all open ie browsers from within vb6?
Printable View
Hey Guys,
Does anyone know how to close all open ie browsers from within vb6?
ud have to get the process.. (iexplore.exe) and kill it...
How would I kill a process in vb6?
avoid killing processes - it causes memory leaks. Just loop through the windows and close them:VB 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 FindWindowEx Lib "user32" Alias "FindWindowExA" ( _ ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long Private Const WM_CLOSE As Long = &H10 Private Sub Command1_Click() Dim lhWnd As Long Do lhWnd = FindWindowEx(0&, lhWnd, "IEFrame", vbNullString) If lhWnd Then PostMessage lhWnd, WM_CLOSE, 0&, 0& Loop While lhWnd End Sub
Worked like a charm thanx man! :wave: