천객만래 [千客萬來] (It has an interminable succession of visitors)

'horizontal'에 해당되는 글 2건

  1. 2010.09.28 [VC++] Adding Explorer Bars
  2. 2010.09.15 [vc++] Implementing Web Browser Band Using ATL HTML Control

Adding Explorer Bars 란 IE에 DeskBand bar를 추가하는 것을말한다.
툴바도 될 수 있고.....

Adding Explorer Bars

This tutorial explains how to add an Explorer Bar in Windows Internet Explorer. If you also want to create a toolbar button for the Explorer Bar, see the Adding Toolbar Buttons tutorial.

Requirements and Dependencies

Developers who want to add menu items to the Tools menu in Internet Explorer must be familiar with the registry. Developers should also be familiar with band objects. For more information on band objects, see the Windows Shell API documentation in the Windows Software Development Kit (SDK).

The implementation described here is valid for Microsoft Internet Explorer 5 or later. To learn how to implement Explorer Bars in Internet Explorer 4.0, see the band objects documentation in the Windows Software Development Kit.

Implementation Steps

The following list contains the steps for adding an Explorer Bar to Internet Explorer.

Icons and strings stored inside a resource can be referenced by providing the path to the resource and reference identification in the format "path, resource_id". For example, if you wanted to use string resource 123 in Example.dll, you would use "Example.dll, 123".

Note  

This tutorial describes how to add an Explorer Bar for all users. You can substitute HKEY_CURRENT_USER for HKEY_LOCAL_MACHINE in the steps below for settings that you want to make per user.

  1. Create a valid GUID.
  2. Create a new key, with the GUID as the name, in the registry under:

    HKEY_CLASSES_ROOT\CLSID\

    The result should look like:

    HKEY_CLASSES_ROOT\CLSID\<Your GUID>
    

    <Your GUID> is the valid GUID that you created in step 1.

    The default value of the key should be set to the name of the Explorer Bar in the View menu.

  3. Create a new key, Implemented Categories, under:

    HKEY_CLASSES_ROOT\CLSID\<Your GUID>

    The result should look like:

    HKEY_CLASSES_ROOT\CLSID\<Your GUID>\Implemented Categories
    
  4. Create a new key using the category identifier (CATID) of the type of Explorer Bar you are creating as the name of the key. This can be one of the following values:
    CATID Description
    {00021494-0000-0000-C000-000000000046} Defines a horizontal Explorer Bar.
    {00021493-0000-0000-C000-000000000046} Defines a vertical Explorer Bar.

    The result should look like:

    //for a horizontal Explorer Bar
    HKEY_CLASSES_ROOT\CLSID\<Your GUID>\
        Implemented Categories\{00021494-0000-0000-C000-000000000046}
    
    //for a vertical Explorer Bar
    HKEY_CLASSES_ROOT\CLSID\<Your GUID>\
        Implemented Categories\{00021493-0000-0000-C000-000000000046}
    
  5. Create a new key, InProcServer32, under:

    HKEY_CLASSES_ROOT\CLSID\<Your GUID>

    The result should look like:

    HKEY_CLASSES_ROOT\CLSID\<Your GUID>\InProcServer32
    

    Set the default value of the key to the full path of the Shdocvw.dll for HTML pages or the .dll file of the Explorer Bar.

  6. Create a new string value, ThreadingModel, under:

    HKEY_CLASSES_ROOT\CLSID\<Your GUID>\InProcServer32

    The result should look like:

    HKEY_CLASSES_ROOT\CLSID\<Your GUID>\InProcServer32\ThreadingModel
    

    Set the value of ThreadingModel to "Apartment".

  7. Create a new key, Instance, under:

    HKEY_CLASSES_ROOT\CLSID\<Your GUID>

    The result should look like:

    HKEY_CLASSES_ROOT\CLSID\<Your GUID>\Instance
    
  8. Required for Explorer Bars that display an HTML page, but optional otherwise. Create a new string value, CLSID, under:

    HKEY_CLASSES_ROOT\CLSID\<Your GUID>\Instance\

    The result should look like:

    HKEY_CLASSES_ROOT\CLSID\<Your GUID>\Instance\CLSID
    

    Set the value of CLSID to {4D5C8C2A-D075-11d0-B416-00C04FB90376}.

  9. Create a new key, InitPropertyBag, under:

    HKEY_CLASSES_ROOT\CLSID\<Your GUID>\Instance

    The result should look like:

    HKEY_CLASSES_ROOT\CLSID\<Your GUID>\Instance\InitPropertyBag
    
  10. Required for Explorer Bars that display an HTML page, but optional otherwise. Create a new string value, Url, under:

    HKEY_CLASSES_ROOT\CLSID\<Your GUID>\Instance\InitPropertyBag

    The result should look like:

    HKEY_CLASSES_ROOT\CLSID\<Your GUID>\Instance\InitPropertyBag\Url
    

    Set the value of Url to the location of the HTML file that contains the content for the Explorer Bar.

  11. Remove the following registry entries:
    HKEY_CLASSES_ROOT\Component Categories\
        {00021493-0000-0000-C000-000000000046}\Enum
    
    HKEY_CLASSES_ROOT\Component Categories\
        {00021494-0000-0000-C000-000000000046}\Enum
    
  12. Optional. Create a new key, using the GUID you created in step 1 as the name, in the registry under:

    HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\Explorer Bars

    HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\Explorer Bars\<Your GUID>
    
  13. Optional. Create a new binary value, BarSize, under:

    HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\Explorer Bars\<Your GUID>

    The result should look like:

    HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\Explorer Bars\<Your GUID>\BarSize
    

    Set the value of BarSize to an 8-byte binary value in hexadecimal notation that sets the default size for the Explorer Bar. The value is interpreted in pixels, so the value "97 00 00 00 00 00 00 00" would be equivalent to setting the default size of the bar to 151 pixels.

Related Topics

Community ContentAdd
Step 11 Incorrect for Vista/IE7

At least with Vista/IE7+ (haven't tested on IE 6 or XP), you need to delete the following keys to get the Explorer Bar recognized:

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Discardable\PostSetup\
Component Categories\{00021493-0000-0000-C000-000000000046}\Enum
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Discardable\PostSetup\
Component Categories\{00021494-0000-0000-C000-000000000046}\Enum


출처 : http://msdn.microsoft.com/en-us/library/aa753590(v=VS.85).aspx

Posted by SB패밀리


Implementing Web Browser Band Using ATL HTML Control


 

The Web Browser Bands were introduced in IE 4.0 , they provide a child window (can be both Horizontal and Vertical ) within the main explorer window. The Search, History and Favourites bars are examples of this bar.

These bands can be used to customise the explorer, to display information and for taking user input.

To create these bars we have to implement and register a band object. The band objects are COM objects which exist inside a container (i.e IE for Explorer Bars). Two main aspects for these band objects are: 

a) How they are registered
Bands must be registered as an OLE in-process server that supports apartment threading, the band objects must be registered for appropriate component category. The category determines the object type and it's container: The Vertical Explorer Bar requires registration in CATID_InfoBand and the Horizontal Explorer Bar requires registration in CATID_CommBand.

b) The interfaces they expose
The interfaces a band object must implement are IDeskBand, IObjectWithSite and IPersistStream. We will get into the specifics of interfaces later in the article. If the band object is to accept user input it has to implement IInputObject  and for a context menu it has to implement IContextMenu.

About the ATL HTML Control

The HTML control hosts the Intrenet Explorer WebBrowser control thus giving you access to script parsing, rendering and browsing fcilities of IE. By default the user interface of the control is provided by the WebBrowser Control, this covers the entire area of the control. The UI is rendered based on the HTML included in the resource of your project.

The control exposes two interfaces: one is for the clients of the control and the other with an UI suffix is used to extend the object model of the Web Browser(being hosted by our control). The script which can access the object model can also access this interface (as window.external) and can call its functions .Your C++ code can access the object model in this function . This communication process can be exploited to accomplish a variety of tasks. For further details on HTML control Dr Richard Grimes book (Professional ATL COM Programming) is the panacea.

About Registration:

For object registration as in-process server I have used the code provided by ATL. For Registring the band object for Category CATID_InfoBand (for Vertical Explorer Band) I have used interface ICatRegister exposed by the Component Categories manager object CLSID_StdComponentCategoriesMgr.

About the Interfaces:

IObjectWithSite This is very critical interface. The explorer calls the IObjectWithSite::SetSite Method passing its site's unknown pointer.The following things are achieved during this call.
If the pointer being passed is not NULL  then site is being set , using this pointer i obtain the IOleWindow Interface and get the parent window's handle and store it. I then create my HTML control as child of this window. I store the pointer to IInputObject site Interface for use later.Also I obtain a pointer to the IWebBrowser2 interface of the IE (parent) and store for use later.The IObjectWithSite::GetSite wraps call to sites QueryInterface.
IPersistStream Since there is no persistent data there is only minimal implementation of this interface.
IDeskBand This interface inherits from IDockingWindow and IOleWindow.The IOleWindow::GetWindow returns the child window handle and ContextSensitive help is not implemented .The IDockingWindow::ShowDW and CloseDW have been implemented but ResizeBorder is not required to be implemented.The IDeskBand::GetBandInfo is used by Explorer to specify the Explorer Bar's identifier and viewing mode.It also may request one or more pieces of information by filling the dwMask member of the DESKBANDINFO structure that is passed as the third parameter

Interaction With the Script:

I have implented a function named OnNag( ) of the interface ICHTMUI (the interface used by the webbrowser control as explained earlier).The script calls this finction passing the dispatch pointer to the HTML anchor element and the string representing the site to navigate to.I use the IWebBrowser2 interface pointer stored earlier to navigate to the site.Thus a click in the Band object causes navigation in the main IE Window.

The band.dll can be downloaded and registered .The menu item is added in View | Explorer Bars. On selecting the menu the Explorer bar is created .The explorer bar has links to some sites, to which one can navigate( in the main IE Window) by clicking on them

The project can be downloaded and by modifying the HTML resource (carefully) you add your own links and customise the GUI of the band.

References:

The article "Creating Custom Explorer Bars and Desk Bands" in SBN



출처 : http://www.codeguru.com/Cpp/I-N/ieprogram/article.php/c1235

Posted by SB패밀리