Microsoft KB Archive/246234

From BetaArchive Wiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Article ID: 246234

Article Last Modified on 4/21/2006



APPLIES TO

  • Microsoft Internet Explorer 5.0
  • Microsoft Internet Explorer 5.01
  • Microsoft Internet Explorer 5.5



This article was previously published under Q246234

SUMMARY

KBBAR is a sample Internet Explorer 5 toolband written in C++ with combined Active Template Library (ATL) and Microsoft Foundation Classes (MFC) code. KBBAR demonstrates how to host a combo box and two buttons on the toolband that use the IWebBrowser interface of the browser to navigate and execute search functionality for Microsoft Knowledge Base articles and the MSDN Web site.

MORE INFORMATION

The following file is available for download from the Microsoft Download Center:

Release Date: May 30, 2001

For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base:

119591 How to Obtain Microsoft Support Files from Online Services


Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on secure servers that prevent any unauthorized changes to the file.

Usage

As a sample, KBBar has been kept intentionally simple. It contains two toolbar buttons and a combo box. The two buttons navigate to the MSDN Web site and the MSDN Web Workshop site, respectively. These locations are currently hard-coded.

You use the combo box to search the Knowledge Base for either a set of keywords or a specific article "Q number." To search by keyword, type the keywords into the edit portion of the toolband and press ENTER. To search for a Q number, type that number with a "#" sign, as in "#Q234234".

The combo box remembers all of the searches entered into it. You can then use the drop-down list to recall any search later.

Architecture

There are three main classes in KBBar:

  • CKBBarBand: (ATL) base level band object that implements the two core interfaces of toolbands, IInputObject and IDeskband. This class contains most of the generic band hosting code.
  • CKBToolBarCtrl: (MFC) an override of the MFC CToolBarCtrl class that encapsulates the creation of the combo box, buttons, and any other associated toolbar buttons. This class handles commands that are generated by the toolbar control through the use of MFC message reflection. This requires a mostly invisible reflection window that sits as a parent between the toolbar control window and the Internet Explorer-owned rebar band site.
  • CKBComboBox: (MFC) an override of the MFC CComboBoxEx class that encapsulates the processing of messages in the combo box, as well as actions taken when a string is entered or an item is selected from the drop-down list.

Sections of interest

  • IInputObject::TranslateAccelerator - keystrokes are passed through to input objects (the toolband is considered an "input object" by the Internet Explorer shell interfaces) through this very important interface. KBBar funnels messages from the low-level band up through the toolbar control to the combo box control.
  • IInputObject::UIActivateIO and IInputObject::HasFocusIO - The Internet Explorer shell interfaces call the band object's IInputObject::UIActiveIO method to notify it of a pending activation. Activation typically occurs when the user presses the TAB key to switch focus to the band object.


When the edit control gets the focus, either through UIActivateIO or by a direct mouse click, it is notified via a CBEN_BEGINEDIT notification message. To signal a change in focus ownership, KBBAR must call back to the IInputObjectSite::OnFocusChangeIS interface. KBBAR centralizes this call in the CKBBarBand::FocusChange method.

Whenever the Internet Explorer shell interfaces has to check focus, IInputObject::HasFocusIO is called. This method merely has to determine if the combo edit control has focus or not, because it is the only control that can keep the focus. This implementation must change if further focusable controls are added to the band.

  • DllUnregisterServer hand removes the toolbar key from the registry. ATL registry scripts can't remove entire registry keys, which is necessary in order to completely unregister the toolbar from Internet Explorer's gaze.


REFERENCES

For more information about developing Web-based solutions for Microsoft Internet Explorer, visit the following Microsoft Web sites:


Additional query words: KBBar

Keywords: kbdownload kbbandobjs kbfile kbsample KB246234