473,385 Members | 1,843 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How to control number of instances of Internet Explorer Created

I have been trying to get an instance of internet explorer to navigate to a website using the Navigate2 command. When the navigation request uses the Get method (just a URL) there is no problem. However, when the navigation involves the post method two instances of internet explorer are created. One of the instances is uninitialized while the other correctly navigates to the site. I need to have only one instance created and have it navigate properly.

To demonstrate and simplify the problem, I created a C# windows form project with only a windows web browser (AxShDocVW.AxWebBrowser (fiWebBrsr)) placed on it. There is a Before_Navigate2 event on the form that determines if there is an Post data associated with the Navigate2 event. If Post data exists, a new instance of SHDocVw.InternetExplorer is created and passed the information from the BeforeNavigate2Event arguments and directed to navigate to the same web site. What is observed is that two instances of an internet explorer will be created. One will successfully navigate to the website indicated. The other one will be tracked by the code but it will be uninitialized. This is the problem I'm trying to resolve. How can the second instance of the internet explorer be prevented and the one being tracked by the code be caused to navigate to the website. I'm using Visual Studio 2008, Internet Explorer 7 and the project is in C#. The code that is associated with the form is shown below:

Expand|Select|Wrap|Line Numbers
  1. namespace Test
  2. {
  3.   public partial class frmSrch : Form
  4.   {
  5.     public frmSrch()
  6.     {
  7.       InitializeComponent();
  8.     }
  9.  
  10.     private void Form1_Shown(object sender, EventArgs e)
  11.     {
  12.       this.fiWebBrwsr.Navigate("http://oregon.jobing.com/");
  13.     }
  14.  
  15.     private void fiWebBrwsr_BeforeNavigate2(object sender, AxSHDocVw.DWebBrowserEvents2_BeforeNavigate2Event e)
  16.     {
  17.       if (!(e.postData == null))
  18.       {
  19.         SHDocVw.InternetExplorer ie = new SHDocVw.InternetExplorer();
  20.         ie.Visible = true;
  21.         ie.Navigate2(ref e.uRL, ref e.flags, ref e.targetFrameName,ref e.postData,ref e.headers);
  22.         e.cancel = true;
  23.       }
  24.     }
  25.   }
  26. }
  27.  
Sep 30 '10 #1
0 1477

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Rea Peleg | last post by:
link to configuration file prevents user control download to internet explorer Hi I have a simple web application which consists an opening html page with a (windows form user) control which...
5
by: Adam Stirk | last post by:
Hi, I have a application that I need to create multiple new "iexplore.exe" processes (show more than once in taskmanger) and control them using the shdocvw/mshtml. I am able control Internet...
1
by: Wayne Gibson | last post by:
Hi, was wondering if anybody could help. I'm looking to create a control that I can embed in a web browser, be it Internet Explorer or FireFox. I know that these used to be ActiveX's when using...
1
by: usenet | last post by:
I have written a Control Library in VS2005 (VB.NET) and am trying to use it inside Internet Explorer. I have copied to DLL to the same folder as the web pages. I have tried the control in an HTML...
4
by: redoix | last post by:
Sometimes There To Many Instance Of The Internet Browsing Page Running On The Taskbar. This Slows Down Connection.how Do I Limit The Instances Of Internet Browsers So That One The Limit Is Reached...
1
by: Adam Clauss | last post by:
We have created an ActiveX control (a series of them actually) which can be loaded into Internet Explorer and accessed via Javascript using the techniques described here:...
2
by: scdowney | last post by:
First and foremost, thank you in advance for any attempts to help me out. I am working on a project with work, and it requires I use CSS selectors to locate elements within a webpage. For the...
1
by: loudey | last post by:
hi I'm making a macro in excel that loads up internet explorer and fills out a form. I'm able to do all of that but i have a hard time to trigger a javascript onchange event that is triggered when a...
1
by: JMANTN | last post by:
I have data that sometimes needs to be uploaded to a 3rd party website and I’m trying to automate this process with Access 2007. I’m having a difficult time with my VBA syntax and with identifying...
2
by: xavierp | last post by:
I just created a website which works fine on Firefox, Opera and Safari but some reason it just has a white tag when i try to open it up in Internet Explorer. I'm only in year 8 so it probably my...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.