Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / July 2003

Tip: Looking for answers? Try searching our database.

Webbrowser not calling IDispatch method

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Daniel Weber - 04 Jul 2003 00:25 GMT
Hi!

In the docs it says: "To gain this control, you need to implement your
host's IDispatch so it handles DISPID_AMBIENT_DLCONTROL. When the WebBrowser
Control is instantiated, it will call your IDispatch::Invoke with this ID."
(ms-help://MS.MSDNQTR.2003FEB.1033/ProgIE/workshop/browser/hosting/wbcustomi
zation.htm).

However, it never does. I implemented a method with that DispID atrribute. I
think the webbrowser attemps to find IDispatch on some other Interface, and
that the class creating it (in this case a user control) is not really the
host.

How is it possible for the webbrowser to call my method ??
thx

Daniel
Vadim Melnik - 04 Jul 2003 11:10 GMT
Hi,

> In the docs it says: "To gain this control, you need to implement your
> host's IDispatch so it handles DISPID_AMBIENT_DLCONTROL. When the WebBrowser
> Control is instantiated, it will call your IDispatch::Invoke with this ID."

(ms-help://MS.MSDNQTR.2003FEB.1033/ProgIE/workshop/browser/hosting/wbcustomi
> zation.htm).
>
[quoted text clipped - 4 lines]
>
> How is it possible for the webbrowser to call my method ??

How do you host this WebBrowser control and override
DISPID_AMBIENT_DLCONTROL property on site object? As far as I know Tim
Anderson's HTMLEditor http://www.itwriting.com/htmleditor/index.php handles
this situation.

..
Regards,
Vadim
Daniel Weber - 04 Jul 2003 12:12 GMT
Vladim,

> How do you host this WebBrowser control and override
> DISPID_AMBIENT_DLCONTROL property on site object? As far as I know Tim
> Anderson's HTMLEditor http://www.itwriting.com/htmleditor/index.php handles
> this situation.

My class inherits those interfaces: IDocHostUIHandler, IOleClientSite
I make a call like this:

((IOleObject)webBrowser.GetOcx()).SetClientSite(this);

Note that 'this' in this context is not a just another class, not the
control where the WebBrowser is embedded.
But it works for IDocHostUIHandler, ShowContext and other methods are
called.
I now have to handle Invoke calls with DISPID_AMBIENT_DLCONTROL:
I implemented this:

[System.Runtime.InteropServices.DispIdAttribute(-5512)]
public int DispidAmbientDlcontr
{
   get{return 0;}
}

and tried that also:

[System.Runtime.InteropServices.DispIdAttribute(-5512)]
public int DispidAmbientDlcontr()
{
   return 0;
}

but it never gets called. I implemented these methods also on the control
(the class actually hosting the webbrowser), it doesn't work.
It says during creation of the webbrowser it gets the hosts IDispatch, so
what IS actually the host ??
Is there a way to let webbrowser know the REAL IDispatch ??

thx

daniel

> Hi,
>
[quoted text clipped - 3 lines]
> > Control is instantiated, it will call your IDispatch::Invoke with this
> ID."

(ms-help://MS.MSDNQTR.2003FEB.1033/ProgIE/workshop/browser/hosting/wbcustomi
> > zation.htm).
> >
[quoted text clipped - 15 lines]
> Regards,
> Vadim

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.