Closing Windows help

munkee

Active member
Joined
Feb 20, 2007
Messages
43
Programming Experience
Beginner
Closing windows / IE error popups help

Alright,
I've written some code that works somewhat as a pop-up blocker for certain error messages that might occur on my software. Just so you know, I'm using a webbrowser control.

VB.NET:
    Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Integer
    Public Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Integer, ByVal hWnd2 As Integer, ByVal lpsz1 As String, ByVal lpsz2 As String) As Integer
    Public Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
    Public Const WM_LBUTTONDOWN As Integer = &H201
    Public Const WM_LBUTTONUP As Integer = &H202
    Public Const WM_CLOSE As Integer = &H10

    Public Shared Function FindMsgBox() As Integer
        Return FindWindow("#32770", "Windows Internet Explorer")
    End Function

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim Box As Integer = FindMsgBox()
        If Box = 0 Then Return

        PostMessage(Box, WM_CLOSE, 0, 0)
    End Sub
Now, there is a new "pop-up" that is bothersome. I've tried to disable it via the Internet Options in Internet Explorer but haven't had any luck.

It is one that has the title of "Internet Explorer Script Error". I have tried to modify my code to work with this window but am very stuck. Can anyone point me in the right direction? I would really appreciate it.


Thanks in advance.
 
Back
Top