How to get a reference to IE from a UserControl?

How to get a reference to IE from a UserControl?

Post by Kim William » Fri, 20 Jul 2001 01:47:43



I am running a Windows Form UserControl inside IE.  I want to control IE
(i.e. to navigate) so I'm trying to get the IWebBrowser2 interface from
inside the WinForm.  I can do this in an ATL control by calling
GetClientSite and QueryInterfacing for IServiceProvider then for
IWebBrowser2.  I can't seem to figure out how to do this in the WinForm.
Basically, all of the available Parent or Container related properties of my
UserControl are either null or won't cast to any of the ActiveX interfaces I
need.  So, I assume I don't have the actually ActiveX object when I
QueryInterface against my UserControl.  Please note I don't want to
instantiate a new browser instance but instead drive the instance that
contains my UserControl.

Any advice would be greatly appreciated since I'm completely stuck!

Thanks,
Kim

 
 
 

How to get a reference to IE from a UserControl?

Post by Mike Hars » Thu, 09 Aug 2001 05:27:43


There is currentl no way to do this in with our default Control.  Doing this
would require unmanged code permission.  The idea behind controls in the
browser is to not require this level of trust.

If you wanted to do this yourself, you could subclass Control and implement
IOleClientSite for the control.  The difficulty in doing htis will be to
hook up our siting stuff proeprly with what IOleClientSite expects.


Quote:> I am running a Windows Form UserControl inside IE.  I want to control IE
> (i.e. to navigate) so I'm trying to get the IWebBrowser2 interface from
> inside the WinForm.  I can do this in an ATL control by calling
> GetClientSite and QueryInterfacing for IServiceProvider then for
> IWebBrowser2.  I can't seem to figure out how to do this in the WinForm.
> Basically, all of the available Parent or Container related properties of
my
> UserControl are either null or won't cast to any of the ActiveX interfaces
I
> need.  So, I assume I don't have the actually ActiveX object when I
> QueryInterface against my UserControl.  Please note I don't want to
> instantiate a new browser instance but instead drive the instance that
> contains my UserControl.

> Any advice would be greatly appreciated since I'm completely stuck!

> Thanks,
> Kim


 
 
 

1. Using UserControls In IE, No Event Capturing?

Ok I've made a test user control and included it in a webpage via the OBJECT
tag.. it shows.. I can call the methods of the UserControl... But how am I
suppose to trap events fired by the control??? Or CAN I?

I tried <SCRIPT FOR> blocks, oCTL.AttachEvent, and just plain
oCTL_Event(sEvent) functions but it doesn't work.. any pointers guys?

2. Looking for a good RF Tx/Rx

3. Hosting Windows.Forms.UserControl in IE

4. disable net use * hole

5. UserControl IE Placeholder not working

6. easy CD Pro 2.11 make bootable CD

7. Debuging UserControl and IE

8. ANNOUNCE: MIB Smithy SDK - SMI/SNMP Extension for Tcl (Commercial)

9. .NET Usercontrols and IE < 6

10. ISA blocking DLL when IE hosts usercontrol

11. Hosting UserControl in IE

12. Can't get UserControl to work in IE---> please help me!

13. usercontrol in ie 5.5??