Browser Helper Object

xiaoxiao2021-03-13  181

Browser Helper Object

In order to attach to a running instance of Internet Explorer, you can use a "Browser Helper Object." A "Browser Helper Object" is a DLL that will attach itself to every new instance of Internet Explorer. You can use this feature to gain Access to the Object Model of a Particular Running Instance Of Internet Explorer. You Can Also Use this feature to get events from an instance of internet explorer.

IEBROWSERHELPER DEMONSTRATESHOWS CREATE AND Register A Browser Helper Object in Delphi, And How To Establish A Two-Way Communication Between Ie and The Helper Object.Internet Explorer 5.0 PROBLEM

Only A Single Browser Helper Object (Bho) Registered Will Load with Internet Explorer 5.0, Becauses of An Internal Buffer Problem. Subsequent Loads of Other Registered Bhos Fail Without apparent error.

Microsoft has confirmed this to be a bug. This problem was corrected in Microsoft Internet Explorer version 5.01.Depending on whether the operating system is Windows 95 and Windows 98 or Windows NT, the BHO that is loaded may be different. On Windows NT, the BHO with the lowest CLSID will be loaded. On Windows 95 and Windows 98, the BHO that was the first registered will be loaded.You can make the use of your BHO more safe, if you during registering of the BHO check for IE-version And Give Some Kind of Warning to the User, IF IE 5.0 is found.

Some Ideas for Use of Browser Helper Object: a. ProgramAtical Activate An Explorer Bar.

IF you have create the use of beable....................

It is easily done with a Browser Helper Object You only need to implement IObjectWithSite Return S_OK in method GetSite and add the following lines in method SetSite: function TIEBrowserHelper.SetSite (const pUnkSite: IUnknown):.. HResult;

VAR

Vaclsid, Vaenabled, Vadummy: olevariant;

Begin

Vaclsid: = '{30D02401-6A81-11D0-8274-00C04FD5AE38}';

Vaenable;

Vadummy: = 0;

(Punksite as IWebBrowser2) .ShowBrowSerbar (Vaclsid, Vaenabled, Vadummy);

Result: = S_OK;

END;

vaCLSID is the Class Identifier for the explorer bar you want to automatically display. The CLSID shown is for the standard Search Bar. If you create an application with a BHO to activate a vertical Explorer bar each time a new instance of Internet Explorer is created and another programmer do the same and both applications are installed on the same computer, one of you definetely have a problem, since IE only can display one vertical explorer bar. Internet Explorer loads all BHO registered and in this case the last BHO loaded is having its explorer bar displayed. On Windows 95/98 the last BHO registered will be the last loaded, but on other versions of Windows is depending on the Class Identifiers. They are loaded in ascending order, so if your randomly created Clsid_YourBHO begins with something like " FFFF -... "You are a lucky programer and almost ceert That Your Bho IS loaded as the last one and your expender bar activated. B. Popup-killers browser helper object is an excellent Place to Avoid Annoying Popup-Windows from Ever Being Displayed. Here Is A Simple One-Line Popup-Killer:

Procedure DobeForenaviGate2 (Const Pdisp: Idispatch)

Var URL: Olevariant; Var Flags: olevariant; var targetframename: olevariant;

Var PostData: Olevariant; Var Headers: olevariant; var ca Zan: WordBool; Begin

IE.Toolbar = 0. Ie.quit;

END;

If the window about to be displayed does not have a toolbar then kill it! It is simple, but it works. The code could be extended to evaluate the size of the window, the title and url before deciding to show or destroy it. C . Download Managers Starting with IE 5.5 a new event OnFileDownload was added to DWebbrowserEvents2. It makes it even easier to let your BHO decide the action, when a user wants to start downloading of a file. The event is called just before showing the Download- dialog in IE. Returning Cancel = True will terminate the download-process and prevent the dialog from being showed. You can now let your download-manager take over the downloading. (For some strange reasons OnFileDownload is called when a new instance of IE is STARTED. You NEED To Handle This, Otherwise Your Application Will Freeze.) IN OLDER VERSIONS OF IE You Will Need To Check for The File-Extensions in OnBeforenaviGate. If IT IS "* .exe", "* .zip" etc. you Can Cancel The Navigation and Start Your Download- Manager.

Enjoy!

Download Browser Helper Object 1.01

Browser Helper Object V. 1.01 for delphi 4/5

Links: Attachment to Internet Explorer using Helper Browser ObjectsControlling Internet Explorer 4 with Browser Helper ObjectsBrowser Helper Objects: The Browser the Way You Want itOnly One Browser Helper Object Will Load with Internet Explorer 5 HOWTO: Programmatically Activate an Explorer Bar

转载请注明原文地址:https://www.9cbs.com/read-129085.html

New Post(0)