473,748 Members | 2,410 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Automating external instances of Internet Explorer in C#

I'm trying to receive events from a running instance of Internet Explorer.
So far I've only been able to receive events from an instance I launch from
code, but I need to receive events from all running instances of Internet
Explorer (I mean those that the user launches himself).

I know this is possible because I did it three months ago. Unfortunately, I
can't find the code. I've already looked at all the Microsoft articles on
automating Internet Explorer, so please don't suggest those links.

Thanks in advance.
Jul 21 '05 #1
12 19611
Hello,

Thanks for your post. As I understand, you want to connect to a running
instance of Internet Explorer. If so, please refer to the KB article 176792.

HOWTO: Connect to a Running Instance of Internet Explorer
http://support.microsoft.com/?id=176792

Hope this helps.

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Jul 21 '05 #2
Thanks, but I've already seen this article, as all other Microsoft articles
that deal with connecting to Internet Explorer.

As in this article, I have code that cycles through ShellWindows and gets a
reference to each running instance of Internet Explorer. That's where I
connect to the IE events, but they simply don't fire.
static private SHDocVw.ShellWi ndows shellWindows = new
SHDocVw.ShellWi ndowsClass();
static private SHDocVw.DWebBro wserEvents2_Bef oreNavigate2Eve ntHandler
beforeNavigate2 ;
static private SHDocVw.DWebBro wserEvents2_New Window2EventHan dler newWindow2;

public static void Main()
{
foreach(SHDocVw .InternetExplor er ie in shellWindows)
{
MessageBox.Show ("ie.Locatio n:" + ie.LocationURL) ;
ie.BeforeNaviga te2 += beforeNavigate2 ;
ie.NewWindow2 += newWindow2;
}
}

The message box displays the URL, but the events simply don't fire.

"Tian Min Huang" <ti******@onlin e.microsoft.com > wrote in message
news:uO******** ******@cpmsftng xa07.phx.gbl...
Hello,

Thanks for your post. As I understand, you want to connect to a running
instance of Internet Explorer. If so, please refer to the KB article 176792.
HOWTO: Connect to a Running Instance of Internet Explorer
http://support.microsoft.com/?id=176792

Hope this helps.

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Jul 21 '05 #3
Hello,

Thanks for your response. Based on my research, I am able to receive the IE
event on my side. I now share the following information with you:

1. You will need to create a WinForm application instead of Console
application.
2. I reviewed your code, it seems that the delegates are not mapped to
methods. Please refer to the following code snippet:

//--------------code snippet----------------------
public class Form1 : System.Windows. Forms.Form
{
static private SHDocVw.ShellWi ndows shellWindows = new
SHDocVw.ShellWi ndowsClass();

public Form1()
{
InitializeCompo nent();

foreach(SHDocVw .InternetExplor er ie in shellWindows)
{
MessageBox.Show ("ie.Locatio n:" + ie.LocationURL) ;
ie.BeforeNaviga te2 += new
SHDocVw.DWebBro wserEvents2_Bef oreNavigate2Eve ntHandler(this. ie_BeforeNaviga t
e2);
}

public void ie_BeforeNaviga te2(object pDisp , ref object url, ref
object Flags, ref object TargetFrameName , ref object PostData, ref object
Headers, ref bool Cancel)
{
MessageBox.Show ("event received!");
}
//----------------end of----------------------------

Please check it on your side.

Have a nice day!

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Jul 21 '05 #4
Nope. Your code does exactly what my code does, and it doesn't fire the
event. I'm running Windows 2000 here. I'll test it tonight on Windows XP.
But this solution must work on Windows 2000 as well. Any ideas?

Andy
"Tian Min Huang" <ti******@onlin e.microsoft.com > wrote in message
news:4A******** ******@cpmsftng xa07.phx.gbl...
Hello,

Thanks for your response. Based on my research, I am able to receive the IE event on my side. I now share the following information with you:

1. You will need to create a WinForm application instead of Console
application.
2. I reviewed your code, it seems that the delegates are not mapped to
methods. Please refer to the following code snippet:

//--------------code snippet----------------------
public class Form1 : System.Windows. Forms.Form
{
static private SHDocVw.ShellWi ndows shellWindows = new
SHDocVw.ShellWi ndowsClass();

public Form1()
{
InitializeCompo nent();

foreach(SHDocVw .InternetExplor er ie in shellWindows)
{
MessageBox.Show ("ie.Locatio n:" + ie.LocationURL) ;
ie.BeforeNaviga te2 += new
SHDocVw.DWebBro wserEvents2_Bef oreNavigate2Eve ntHandler(this. ie_BeforeNaviga t e2);
}

public void ie_BeforeNaviga te2(object pDisp , ref object url, ref
object Flags, ref object TargetFrameName , ref object PostData, ref object Headers, ref bool Cancel)
{
MessageBox.Show ("event received!");
}
//----------------end of----------------------------

Please check it on your side.

Have a nice day!

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Jul 21 '05 #5
You're right. It works, but only under XP. I'm not receiving any events
under Windows 2000.

Is there a reason?

"Tian Min Huang" <ti******@onlin e.microsoft.com > wrote in message
news:4A******** ******@cpmsftng xa07.phx.gbl...
Hello,

Thanks for your response. Based on my research, I am able to receive the IE event on my side. I now share the following information with you:

1. You will need to create a WinForm application instead of Console
application.
2. I reviewed your code, it seems that the delegates are not mapped to
methods. Please refer to the following code snippet:

//--------------code snippet----------------------
public class Form1 : System.Windows. Forms.Form
{
static private SHDocVw.ShellWi ndows shellWindows = new
SHDocVw.ShellWi ndowsClass();

public Form1()
{
InitializeCompo nent();

foreach(SHDocVw .InternetExplor er ie in shellWindows)
{
MessageBox.Show ("ie.Locatio n:" + ie.LocationURL) ;
ie.BeforeNaviga te2 += new
SHDocVw.DWebBro wserEvents2_Bef oreNavigate2Eve ntHandler(this. ie_BeforeNaviga t e2);
}

public void ie_BeforeNaviga te2(object pDisp , ref object url, ref
object Flags, ref object TargetFrameName , ref object PostData, ref object Headers, ref bool Cancel)
{
MessageBox.Show ("event received!");
}
//----------------end of----------------------------

Please check it on your side.

Have a nice day!

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Jul 21 '05 #6
Hi,

As stated in my previous reply, it works properly on my Windows 2000
systems. I think more information is needed before moving forward:

1. Did you install .NET Framework 1.1 on your Windows 2000?
2. Did you apply Windows 2000 Service Pack 3?
3. What's the version of IE on your Windows 2000?
4. Please try my sample attached in my previous post.

I am standing by for your response.

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Jul 21 '05 #7
Thank you for not abandoning me.

1. I have the .NET Framework 1.0.3705 and 1.1 installed (same as on my XP
system).
2. I have Windows 2000 with Service Pack 4.
3. I have Internet Explorer 6.0.2800.1106 with Service Pack 1 and Q828750.
4. I have tried your code, with the same result.

I know it shouldn't make any difference, but I should mention that on the
Windows 2000 system, I also have Visual Studio 6 installed. I had to go
through extensive tinkering as per the following article
http://msdn.microsoft.com/library/de...us/dnvid/html/
msdn_videbuggin g.asp
to enable debugging in Interdev.

Also, it just occurred to me that I have Visual Studio .NET Professional
2002 on the Windows 2000 system, and Visual Studio .NET Enterprise Architect
2003 on the XP system.

Thanks again.
"Tian Min Huang" <ti******@onlin e.microsoft.com > wrote in message
news:Kl******** ******@cpmsftng xa07.phx.gbl...
Hi,

As stated in my previous reply, it works properly on my Windows 2000
systems. I think more information is needed before moving forward:

1. Did you install .NET Framework 1.1 on your Windows 2000?
2. Did you apply Windows 2000 Service Pack 3?
3. What's the version of IE on your Windows 2000?
4. Please try my sample attached in my previous post.

I am standing by for your response.

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Jul 21 '05 #8
Hello,

Thanks for your reply. It's strage that I am not able to reproduce the
problem on my Windows 2000 test sytems with similar configuration (Win2K
SP4, IE6 SP1, .NET Framework 1.1). To narrow down the problem, I recommend
you build a new Windows 2000 system with .NET Framework 1.1 and check if
the problem persists on your side.

Hope this helps.

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Jul 21 '05 #9
Thanks.

I take back what I said. Your executable works on all the Windows 2000
systems I've tried it on. But when I compile your source code using VS.NET
2002 the event doesn't fire on the two computers that have VS.NET 2002
installed, but it fires on a clean Windows 2000 system with just the .NET
Framework 1.1 installed and no VS.NET.

I will try compiling the same code on XP with VS.NET 2003, then run it on
the same Windows 2000 computers to see if it has to do with VS.NET 2002, but
right now it looks like the culprit.


"Tian Min Huang" <ti******@onlin e.microsoft.com > wrote in message
news:Yz******** ******@cpmsftng xa07.phx.gbl...
Hello,

Thanks for your reply. It's strage that I am not able to reproduce the
problem on my Windows 2000 test sytems with similar configuration (Win2K
SP4, IE6 SP1, .NET Framework 1.1). To narrow down the problem, I recommend
you build a new Windows 2000 system with .NET Framework 1.1 and check if
the problem persists on your side.

Hope this helps.

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Jul 21 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2830
by: Mark | last post by:
Hi all, Im written a small javascript program. Once it finishs I want to close the internet explorer page. I have used window.close(); when this runs it pops up with a Internet Explorer Dialog box, saying if I want to close this page. Is there a way to automate this process?? I also have the problem with var fso = new ActiveXObject('Scripting.FileSystemObject');
6
4592
by: tinkerman | last post by:
Hello net friends, I need to automate Internet Explorer in a very simple way. I need to: 1. press refresh (F5) on the currently loaded website. 2. press END button. 3. Click a button somewhere on the screen with the mouse left button (I'm not sure this button can be pressed directly via keysequence, not via mouse, but it does have a name).
10
2396
by: milk-jam | last post by:
I'm trying to write a log which save each time internet explorer is opened or closed and all of the url which where visited? Any help is greatly appreciated.
12
756
by: SunshineGirl | last post by:
I'm trying to receive events from a running instance of Internet Explorer. So far I've only been able to receive events from an instance I launch from code, but I need to receive events from all running instances of Internet Explorer (I mean those that the user launches himself). I know this is possible because I did it three months ago. Unfortunately, I can't find the code. I've already looked at all the Microsoft articles on automating...
4
3198
by: attachmatey | last post by:
Greetings: I'm looking for some help in automating (what I thought would be) a simple procedure in Internet Explorer. I'm trying to put the following operation under a button click in an MS Access database form: 1. Navigate to URL and click button 2. Enter user name and password 3. Apply filters (enter criteria in text boxes) 4. Execute query (another button click) 5. Export results to network server 6. Data mining using Monarch...
4
2564
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 Additional Page Can Not Be Opened
3
9588
by: Matthew Lock | last post by:
Hello, I am automating Internet Explorer in order to do some simple automated testing of a web application. How do I invoke Javascript functions in the web page I load? I can successfully start an instance of Internet Explorer and control the DOM, but I don't know how to call Javascript functions. Here is the code I am using so far: public class WebBrowser
1
4848
by: avpkills2002 | last post by:
I seem to be getting this weird problem in Internet explorer. I have written a code for parsing a XML file and displaying the output. The code works perfectly fine with ffx(Firefox).However is not working in Internet Explorer.(I m using Internet Explorer 6.0). The code is as follows: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:// www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html...
0
1507
by: Bill Corry | last post by:
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...
0
8991
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8831
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9552
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9326
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9249
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8245
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6796
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4607
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
2215
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.