??? How to - Control IE useing VB.NET ???

nomaam

Member
Joined
Jul 4, 2004
Messages
12
Programming Experience
Beginner
Is it possible to limit the number of open Internet Explorer windows?

My VB.NET program will be using IE, and I would like to ensure that only one IE window can be open. This will be done to prevent pop-up windows from interfering with its work.

I know there are free pop-up blocking programs that I can use, but I would like to have this function built into my program.

Any help would be appreciated.

I have found this code to ensure that only one instance of the VB.NET program is open; could this be modified to control the amount of IE windows?

This is the code:

VB.NET:
Private Sub Form_Load()
	' See if there is already and instance.
	If App.PrevInstance Then
		' Activate the previous instance
		AppActivate App.Title

		' Send a key (here SHIFT-key) to set the
		' form from the previous instance to the
		' top of the screen.
		SendKeys "+", True

		' Terminate the new instance
		Unload Me
	End If
End Sub


I am fairly new to VB.NET.
 

maxmanzero

Member
Joined
Sep 29, 2004
Messages
12
Programming Experience
Beginner
NewWindow2 event

The NewWindow2 event will fire from the WebBrowser control if a popup is in the process of being generated. If you set the cancel event to e.Cancel = true, then the window will be blocked. Keep in mind that this will block all popup's.
 
Top Bottom