The Project
The project for this chapter is fairly straightforward. We are going to start with the browser helper object that we built in Chapter 12 and give it a user interface. Not too creative, but that’s not really the point. The point is to show you how you can take a simple component like a BHO and give it a user interface. Coming up with a creative way to use this knowledge will be your job. Now, how’s that for passing the buck? You might be saying to yourself, “The component in Chapter 12 already has a user interface.” True, but browser extensions (as opposed to BHOs) are for IE 5.0 and up. A BHO with a docking window is backwards compatible to IE 4.0.
Primary Component
Let’s start with the
IObjectWithSite::SetSite method of the component
we built in Example 12.2. We’ll add the code
necessary for the docking window and then discuss the details. We
only need to add a few new lines of code, which appear in boldface in
Example 14.1.
Example 14-1. SetSite in Primary Object
Private Const IID_IShellBrowser = _ "{000214e2-0000-0000-c000-000000000046}" Private Const IID_IDockingWindowFrame = _ "{47d2657a-7b27-11d0-8ca9-00a0c92dbfe8}" Private szToolbar As String Private Sub Class_Initialize( ) szToolbar = "IEDockingWindow" End Sub Private Sub IObjectWithSite_SetSite(ByVal pSite As IUnknownVB) If ObjPtr(pSite) = 0 Then CopyMemory m_ie, 0&, 4 Exit Sub End If Set m_pUnkSite = pSite 'Save the site pointer for GetSite Dim pServiceProvider As IServiceProvider Set pServiceProvider ...Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access