3

Beginning with Delphi 10.0 Seattle, Embarcadero has changed the implementation of the TWebBrowser control:

Pre-Seattle: TWebBrowser = class(TOleControl)

Seattle+: TWebBrowser = class(TOleControl, IDocHostUIHandler, IDocHostShowUI, IOleCommandTarget)

I have somewhat old code running where I had implemented a class that could register as a client site/host for a TWebBrowser where I provided my own implementation of the IDocHostUIHandler interface.

Since a TWebBrowser is now implementing these from the start (and keeping them private) and is hard to descend from for all I know - how do I go about to get the new TWebBrowser component to re-register where to find an implementation for IDocHostUIHandler?

nelshh
  • 1,021
  • 1
  • 11
  • 15
  • Wouldn't it be easiest either to use an earlier version of ShDocVw.Pas, or simply create your own import unit for the webbrowser? You don't have to use the Delphi-supplied one. – MartynA Aug 03 '16 at 10:23

1 Answers1

6

You can descend from TWebBrowser and provide your own interface definitions as before, like this:

Type
  TMyWebBrower = class( TWebBrowser, IDocHostUIHandler )
  ...
  end;

This tells Delphi that you are reimplementing the IDocHostUIHandler interface. You must provide all functions for the interface, but you already have that.

Dsm
  • 5,870
  • 20
  • 24