Close all open IE Browsers from within VB6

Discussion in 'Software' started by ceal21c, Jun 27, 2006.

  1. ceal21c

    ceal21c Private E-2

    Hey Guys,

    Does anyone know how to close all open ie browsers from within vb6?
     
  2. ceal21c

    ceal21c Private E-2

    Hey Everyone,

    Found this soloution to my problem hope it helps someone else.

    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

    'FYI You don't have to put this code in your load event if you don't want to.

    Private Sub Form_Load()

    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
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds