11.4 Namespace Interfaces

only for RuBoard - do not distribute or recompile

11.4 Namespace Interfaces

There are four primary interfaces that must be implemented when working with a namespace extension. These are:

  • IPersistFolder

  • IShellFolder

  • IShellView

  • IEnumIDList

Let's briefly discuss these interfaces. We'll go into more detail as we implement each one.

11.4.1 IPersistFolder

This interface is used to initialize shell folder objects. This interface contains one method inherited from IPersist , GetClassID , and one native method called Initialize . Initialize is used when the contents of the folder need a fully qualified PIDL in relation to the junction point of the extension. These methods are described in Table 11.1.

Table11.1. IPersistFolder Methods

Method

Description

GetClassID

Returns the CLSID of the object implementing IPersistFolder .

Initialize

Instructs the object to initialize itself based on the PIDL that is passed in by the shell.

The IDL for IPersistFolder is shown in Example 11.1.

Example 11.1. IPersistFolder
 typedef [public] long CLSID; typedef [public] long LPCITEMIDLIST; [     uuid(000214ea-0000-0000-c000-000000000046),     helpstring("IPersistFolder Interface"),     odl ] interface IPersistFolder : IUnknown {     // IPersist methods      HRESULT GetClassID([in, out] CLSID *lpClassID);     // IPersistFolder methods      HRESULT Initialize([in] LPCITEMIDLIST pidl); } 
11.4.1.1 GetClassID

This method returns the CLSID of the object implementing IPersistFolder . This method is inherited from IPersist , and its syntax is as follows :

 HRESULT GetClassID( CLSID   *pClassID   ); 

Its single parameter is:

pClassID

This is an [in, out] parameter that should contain the class identifier of the object that is implementing IPersistFolder .

11.4.1.2 Initialize

This tells the object to initialize itself based on the PIDL that is passed in. Its syntax is:

 HRESULT Initialize(LPCITEMIDLIST   pidl   ); 

with the following parameter:

pidl

Address of an ITEMIDLIST structure that contains the location of the folder.

When a folder's location in the namespace does not matter, this function can simply return S_OK .

11.4.2 IShellFolder

IShellFolder contains ten methods that are used to manage shell folders. This is really considered the primary interface of the namespace extension, because the shell uses this interface to communicate all of its requests to the extension object.

IShellFolder is responsible for creating references to IShellView for managing the view and to IEnumIDList for enumerating the folder's contents. In addition, IShellFolder provides references to IExtractIcon (so the shell can display icons for each item in the namespace) and to IContextMenu for any context menu support the namespace might need. The methods of IShellFolder are described in Table 11.2. Note that the methods that require vtable swapping are in boldface. Methods marked with an asterisk (*) do not need to be implemented for namespace extensions. Because we already have enough things to remember, we will focus only on the methods that require implementation.

Table11.2. IShellFolder Methods

Method

Description

BindToObject

Returns the IShellFolder interface for the specified subfolder.

BindToStorage *

Not currently implemented.

CompareIDs

Determines the relative order of two file objects or folders, given their item identifier lists.

CreateViewObject

Creates a view object of the folder. This method is responsible for creating an instance of an object that implements the IShellView interface.

EnumObjects

Creates an instance of an object that implements the IEnumIDList interface. The primary function of this object is to enumerate the contents of a folder.

GetAttributesOf

Returns the attributes of the specified file object or subfolder. This method informs the shell whether an item is folder, has subfolders , etc.

GetDisplayNameOf

Returns the display name of a file object or subfolder.

GetUIObjectOf

Creates an interface that can be used to carry out operations on a file object or subfolder. Interfaces returned by this method include IExtractIcon and IContextMenu.

ParseDisplayName *

Translates a display name into an item identifier list.

SetNameOf *

Sets the display name of the specified file object or subfolder.

The IDL for IShellFolder is shown in Example 11.2.

Example 11.2. IShellFolder
 // IShellFolder::GetDisplayNameOf/SetNameOf uFlags typedef enum {     SHGDN_NORMAL             = 0,             SHGDN_INFOLDER           = 1,             SHGDN_INCLUDE_NONFILESYS = 0x2000,       SHGDN_FORADDRESSBAR      = 0x4000,        SHGDN_FORPARSING         = 0x8000,    } SHGNO; // IShellFolder::EnumObjects typedef enum {     SHCONTF_FOLDERS         = 32,     SHCONTF_NONFOLDERS      = 64,     SHCONTF_INCLUDEHIDDEN   = 128, } SHCONTF; // IShellFolder::GetAttributesOf flags typedef enum {     SFGAO_CANCOPY           = 0x00000001,     SFGAO_CANMOVE           = 0x00000002,     SFGAO_CANLINK           = 0x00000004,     SFGAO_CANRENAME         = 0x00000010,      SFGAO_CANDELETE         = 0x00000020,          SFGAO_HASPROPSHEET      = 0x00000040,          SFGAO_DROPTARGET        = 0x00000100,          SFGAO_CAPABILITYMASK    = 0x00000177,     SFGAO_LINK              = 0x00010000,          SFGAO_SHARE             = 0x00020000,          SFGAO_READONLY          = 0x00040000,          SFGAO_GHOSTED           = 0x00080000,          SFGAO_HIDDEN            = 0x00080000,          SFGAO_DISPLAYATTRMASK   = 0x000F0000,     SFGAO_FILESYSANCESTOR   = 0x10000000,          SFGAO_FOLDER            = 0x20000000,          SFGAO_FILESYSTEM        = 0x40000000,          SFGAO_HASSUBFOLDER      = 0x80000000,          SFGAO_CONTENTSMASK      = 0x80000000,     SFGAO_VALIDATE          = 0x01000000,          SFGAO_REMOVABLE         = 0x02000000,          SFGAO_COMPRESSED        = 0x04000000,          SFGAO_BROWSABLE         = 0x08000000,          SFGAO_NONENUMERATED     = 0x00100000,          SFGAO_NEWCONTENT        = 0x00200000,      }SFGAO; [     uuid(000214e6-0000-0000-c000-000000000046),     helpstring("IShellFolder Interface"),     odl ] interface IShellFolder : IUnknown {     HRESULT ParseDisplayName([in] HWND hwndOwner,                               [in] LPBC pbcReserved,                               [in] LPOLESTR lpszDisplayName,                              [in] ULONG * pchEaten,                               [in, out] LPITEMIDLIST * ppidl,                               [in, out] ULONG *pdwAttributes);     HRESULT EnumObjects([in] HWND hwndOwner,                          [in] DWORD grfFlags,                          [in, out] LPENUMIDLIST * ppenumIDList);     HRESULT BindToObject([in] LPCITEMIDLIST pidl,                          [in] LPBC pbcReserved,                          [in] REFIID riid,                          [in, out] LPVOID * ppvOut);     HRESULT BindToStorage([in] LPCITEMIDLIST pidl,                            [in] LPBC pbcReserved,                            [in] REFIID riid,                            [in,out] LPVOID * ppvObj);     HRESULT CompareIDs([in] LPARAM lParam,                         [in] LPCITEMIDLIST pidl1,                         [in] LPCITEMIDLIST pidl2);     HRESULT CreateViewObject([in] HWND hwndOwner,                               [in] REFIID riid,                               [in,out] LPVOID * ppvOut);     HRESULT GetAttributesOf([in] UINT cidl,                              [in,out] LPCITEMIDLIST * apidl,                              [in,out] ULONG * rgfInOut);     HRESULT GetUIObjectOf([in] HWND hwndOwner,                            [in] UINT cidl,                            [in,out] LPCITEMIDLIST * apidl,                           [in] REFIID riid,                            [in,out] UINT * prgfInOut,                            [in,out] LPVOID * ppvOut);     HRESULT GetDisplayNameOf([in] LPCITEMIDLIST pidl,                               [in] DWORD uFlags,                               [in] LPSTRRET lpName);     HRESULT SetNameOf([in] HWND hwndOwner,                        [in] LPCITEMIDLIST pidl,                        [in] LPCOLESTR lpszName,                        [in] DWORD uFlags,                        [in,out] LPITEMIDLIST * ppidlOut); } 
11.4.2.1 BindToObject

This function retrieves the IShellFolder interface for a subfolder. BindToObject is called by the shell whenever a folder is opened. The major responsibility of this function is to provide the shell with an interface pointer to IShellFolder (for the subfolder). It is defined like so:

 HRESULT BindToObject(LPCITEMIDLIST   pidl   ,                       LPBC   pbcReserved   ,                       REFIID   riid   ,                       LPVOID *ppvOut); 

with the following parameters:

pidl

[in] Is the PIDL of the parent folder.

pbcReserved

[in] Reserved; will be NULL.

riid

[in] Points to the interface identifier for IShellFolder .

ppvOut

[in, out] Gives the shell the IShellFolder interface for the subfolder.

11.4.2.2 CompareIDs

This function determines the display order of two folders or items. Its definition is as follows:

 HRESULT CompareIDs(LPARAM   lParam   ,                     LPCITEMIDLIST   pidl1   ,                     LPCITEMIDLIST   pidl2   ); 

with the following parameters:

lParam

[in] This value will always be when this function is called by the shell.

pidl1 / pidl2

[in] These two PIDLs uniquely identify items or folders for comparison.

The method of comparison performed by this function is entirely up to the implementer. It will be different for every namespace extension, because the PIDL will most likely have a different format across extensions.

The function must return one of the following values:

< 0

The first PIDL should be displayed first ( pidl1 < pidl2 ).

> 0

The second PIDL should be displayed first ( pidl1 > pidl2 ).

= 0

The two items are the same ( pidl1 = pidl2 ).

11.4.2.3 CreateViewObject

This method is responsible for creating the view object for a shell folder. Its syntax is:

 HRESULT CreateViewObject(HWND   hwndOwner   , REFIID   riid   , LPVOID   *ppvOut   ); 

It has the following parameters:

hwndOwner

[in] The handle of the window that is the parent to the view object.

riid

[in] The IShellView interface identifier.

ppvOut

[in, out] The address of the view object that will be returned to the shell.

The important thing to remember when implementing this method is that the object implementing IShellView must be different than the object that is implementing IShellFolder . This is to accommodate support for multiple views.

11.4.2.4 EnumObjects

This method creates an enumeration object (an object that implements IEnumIDList ) that the shell will use to enumerate, and consequently display, the contents of a folder. It is defined as:

 HRESULT EnumObjects(HWND   hwndOwner   , DWORD   grfFlags   ,                      LPENUMIDLIST   *ppenumIDList   ); 

with the following parameters:

hwndOwner

[in] Handle to the owner window a client should use to display a dialog or message box. The VB MsgBox function does not have an hWnd parameter (unlike the MessageBox API function), so this parameter can be ignored.

grfFlags

[in] Items that should be included in the enumeration. This value can be one or more of the following values:

Constant

Description

SHCONTF_FOLDERS

Include folders.

SHCONTF_NONFOLDERS

Include non-folders (items).

SHCONTF_INCLUDEHIDDEN

Include hidden items.

ppenumIDList

[out, retval] Address that receives a pointer to the IEnumIDList interface of the enumeration object.

As is the case with the view object, the enumeration object needs to be implemented in a separate object.

11.4.2.5 GetAttributesOf

This function retrieves the attributes of one or more folders or items. In terms of namespace extensions, the primary purpose of this method is to determine if a given item is a folder and, if so, whether it has subfolders. Its definition is:

 HRESULT GetAttributesOf(UINT   cidl   , LPCITEMIDLIST   *apidl   , ULONG   *rgfInOut   ); 

with the following parameters:

cidl

[in] The number of PIDLs that are being pointed to by apidl .

apidl

[in, out] A pointer to an array of PIDLs.

rgfInOut

[in, out] One or more constants from the SFGAO enumeration (see Appendix A ), shown upon returning from this method. When implementing namespace extensions, however, the primary values of concern for this flag are:

Constant

Description

SFGAO_FOLDER

The item is a folder.

SFGAO_HASSUBFOLDER

The item contains subfolders.

If the SFGAO_HASSUBFOLDER bit has been set, the shell will draw a "+" node next to the folder.

11.4.2.6 GetDisplayNameOf

Provides a display name for a given PIDL. Its syntax is:

 HRESULT GetDisplayNameOf(LPCITEMIDLIST   pidl   , DWORD   uFlags   , LPSTRRET   lpName   ); 

Its parameters are:

pidl

[in] The PIDL for which a display name is being requested .

uFlags

[in] Flags indicating the type of display name being requested. These values come from the SHGNO enumeration, which contains the following values:

Constant

Description

SHGDN_NORMAL

The full path of the PIDL from the root.

SHGDN_INFOLDER

The name is relative to the folder that is processing the name.

SHGDN_FORADDRESSBAR

The name will be used for display in the address bar combo box.

SHGDN_FORPARSING

This flag can be ignored for this discussion.

SHGDN_INCLUDE_NONFILESYS

This flag can be ignored for this discussion.

lpName

[in] The address of an STRRET structure, which is defined like this:

 typedef struct _STRRET {     UINT uType;     union {         LPWSTR pOleStr;         LPSTR pStr;         UINT uOffset;         char cStr[MAX_PATH];     } DUMMYUNIONNAME; } STRRET, *LPSTRRET; 

As you can see, this structure contains a union, which has no analogue in Visual Basic. If you consider that, internally, all strings in VB are in Unicode, then the following redefinition makes sense (regardless of your platform):

 Public Type STRRET     uType As UINT     pOLESTR As Long End Type 

The uType member can be one of the following values, although it should always equal STRRET_WSTR (in terms of the above definition of STRRET ):

Constant

Description

STRRET_CSTR

The string is returned in the cStr member of the structure.

STRRET_OFFSET

The uOffset member value indicates the number of bytes from the beginning of the item identifier list where the string is located.

STRRET_WSTR

The string is at the address pointed to in the pOleStr member. This is a pointer to a Unicode string.

pOLESTR will point to a string that contains the display name.

11.4.2.7 GetUIObjectOf

The shell will call this method for any additional interfaces it might need to complete its functionality. For instance, the icons that are displayed for the namespace extension are managed by an object that implements IExtractIcon . When the shell is ready to display icons, it will call this method for the object. If the namespace has a context menu, the shell will call this method, asking for an object that implements IContextMenu . Maybe your extension provides InfoTips. If that is the case, the shell would call this method requesting an object that supports IQueryInfo .

GetUIObjectOf has the following definition:

 HRESULT GetUIObjectOf(     HWND   hwndOwner   ,     UINT   cidl   ,     LPCITEMIDLIST   *apidl   ,     REFIID   riid   ,     UINT   *prgfInOut   ,     LPVOID   *ppvOut   ); 

Its parameters are:

hwndOwner

[in] Handle to the owner window that a client should use to display a dialog or message box. The VB MsgBox function does not have an hWnd parameter (unlike the MessageBox API function), so this parameter can be ignored.

cidl

[in] The number of PIDLs that are being pointed to by apidl .

apidl

[in, out] A pointer to an array of PIDLs.

riid

[in] A pointer to the GUID of the interface being requested.

prgfInOut

[in, out] Reserved.

ppvOut

[in] The address that receives the interface pointer.

The most common interfaces requested by the shell are shown in the following table:

Interface Identifier

Allowed cidl Value

IContextMenu

>=1

IContextMenu2

>=1

IDataObject

>=1

IDropTarget

=1

IExtractIcon

=1

IQueryInfo

=1

The only interface on this list that we have not discussed is IContextMenu2 . This interface provides additional methods that allow the context menu to contain owner-drawn items.

11.4.3 IShellView

IShellView , which is derived from IOleWindow , is responsible for creating the view object and maintaining communication between the view and Explorer's frame window. This communication involves translating window messages, adding menu items and toolbar buttons , providing help text in the status bar, and maintaining the state of the view window. IShellView is composed of 12 methods, which are listed in Table 11.3. Methods marked with an asterisk do not need to be implemented.

Table11.3. IShellView Methods

Method

Description

AddPropertySheetPages *

Adds pages to the Options property sheet.

CreateViewWindow

Creates the view window.

ContextSensitiveHelp *

Determines whether context-sensitive help mode should be entered during an in-place activation session.

DestroyViewWindow

Destroys the view window.

EnableModeless *

Is not currently in use by Explorer.

EnableModelessSV *

Is not currently in use.

GetCurrentInfo

Returns the current folder settings. This is basically the type of view currently in use: Large Icons, Small Icons, List, or Details. This is how view state is maintained between the different namespace extensions that are grouped by the shell.

GetItemObject *

Is not used by namespace extensions.

GetWindow

Is inherited from IOleWindow . It should return the handle to the view object.

Refresh

Refreshes the display in response to a View figs/u2192.gif Refresh menu selection or to pressing F5.

SaveViewState *

Saves the shell's view settings so the current state can be restored during a future session.

SelectItem *

Changes the selection state of items within the shell view window.

TranslateAccelerator *

Translates accelerator keystrokes when a namespace extension's view has the focus.

UIActivate

Called whenever the activation state of the view window is changed by an event external to the view object itself.

The IDL for IShellView is contained in Example 11.3.

Example 11.3. IShellView
 // shellview select item flags typedef enum {     SVSI_DESELECT       = 0x0000,     SVSI_SELECT         = 0x0001,     SVSI_EDIT           = 0x0003,     SVSI_DESELECTOTHERS = 0x0004,     SVSI_ENSUREVISIBLE  = 0x0008,     SVSI_FOCUSED        = 0x0010,     SVSI_TRANSLATEPT    = 0x0020, } SVSI; // shellview get item object flags typedef enum {     SVGIO_BACKGROUND    = 0x00000000,     SVGIO_SELECTION     = 0x00000001,     SVGIO_ALLVIEW       = 0x00000002, } SVGIO; // uState values for IShellView::UIActivate typedef enum {     SVUIA_DEACTIVATE       = 0,     SVUIA_ACTIVATE_NOFOCUS = 1,     SVUIA_ACTIVATE_FOCUS   = 2,     SVUIA_INPLACEACTIVATE = 3 } SVUIA_STATUS; [     uuid(000214e3-0000-0000-c000-000000000046),     helpstring("IShellView Interface"),     odl ] interface IShellView: IUnknown {     // IOleWindow     HRESULT GetWindow([out, retval] HWND * lphwnd);     HRESULT ContextSensitiveHelp([in] BOOL fEnterMode);     // IShellView     HRESULT TranslateAccelerator([in] LPMSG lpmsg);     HRESULT EnableModeless([in] BOOL fEnable);     HRESULT UIActivate([in] UINT uState);     HRESULT Refresh(  );     HRESULT CreateViewWindow([in,out] IShellView  *lpPrevView,                              [in] LPCFOLDERSETTINGS lpfs,                              [in,out] IShellBrowser *psb,                              [in] LPRECT prcView,                              [in,out] HWND  *phWnd);     HRESULT DestroyViewWindow(  );     HRESULT GetCurrentInfo([in] LPFOLDERSETTINGS lpfs);     HRESULT AddPropertySheetPages([in] DWORD dwReserved,                                    [in] LPFNADDPROPSHEETPAGE lpfn,                                    [in] LPARAM lparam);     HRESULT SaveViewState(  );     HRESULT SelectItem([in] LPCITEMIDLIST pidlItem,                         [in] UINT uFlags);     HRESULT GetItemObject([in] UINT uItem,                            [in] REFIID riid,                            [out, retval] IUnknown **ppv); } 

Of the methods shown in Table 11.3, the six discussed in the following sections must be implemented.

11.4.3.1 CreateViewWindow

This method is responsible for creating the view window. It is defined as follows in the Platform SDK:

 HRESULT CreateViewWindow(     ISHELLLINK *lpPrevView,     LPFOLDERSETTINGS lpfs,     IShellBrowser *psb,     RECT *prcView,     HWND *phWnd); 

But the documentation is in error. The first parameter should be a pointer to an IShellView interface:

 HRESULT CreateViewWindow(     IShellView *lpPrevView,     LPFOLDERSETTINGS lpfs,     IShellBrowser *psb,     RECT *prcView,     HWND *phWnd); 

The parameters of the correct version of the method prototype are:

lpPrevView

[in, out] A pointer to the IShellView interface of the view object that is being closed. This value can also be NULL .

lpfs

[in] Address of a FOLDERSETTINGS structure, which is defined as:

 typedef struct {     UINT ViewMode;     UINT fFlags; }FOLDERSETTINGS; 

This structure is not used by the namespace directly, so a discussion is not in order. The shell will use this structure to communicate the current view to the namespace extension (Large Icons, Details, List, etc.). The namespace extension should cache this structure, so it can return it when the shell calls GetCurrentInfo .

psb

[in, out] Address of the current instance of the IShellBrowser interface. The view should call AddRef on this interface and keep the interface pointer to allow communication with Explorer's frame window.

prcView

[in] Dimension of the view window in client coordinates.

phWnd

[in, out] Address of the window handle being created.

11.4.3.2 DestroyViewWindow

This method is called when the view window (or Explorer) is being closed. Its syntax is simply:

 HRESULT DestroyViewWindow(  ); 
11.4.3.3 GetCurrentInfo

This method is called by the shell to retrieve the current folder settings. The folder settings that were passed to CreateViewWindow can be returned to the shell via this method. Its syntax is:

 HRESULT GetCurrentInfo(LPFOLDERSETTINGS lpfs); 

It has a single parameter:

lpfs

[in] The address of a FOLDERSETTINGS structure. For information on the FOLDERSETTINGS structure, see the description of the CreateViewWindow method.

11.4.3.4 GetWindow

This method, which is inherited from IOleWindow , should return the window handle of the view object. Its syntax is:

 HRESULT GetWindow(HWND *   phwnd   ); 

Its single parameter is:

phwnd

[out, retval] The address of the view object's window handle.

11.4.3.5 Refresh

This method refreshes the view object when the Refresh menu item is selected from Explorer's menu (or F5 is pressed). Its syntax is simply:

 HRESULT Refresh(  ); 
11.4.3.6 UIActivate

This method is called when the activation state of the view window is changed by an event outside of the shell. For example, if the Tab key is pressed when the tree has the focus, the view window should be given the focus. The syntax of UIActivate is:

 HRESULT UIActivate(UINT uState); 

The method has the following parameters:

uState

[in] Contains flags specifying the activation state of the window. This can be one of the following values:

Constant

Description

SVUIA_ACTIVATE_FOCUS

The view window has the input focus.

SVUIA_ACTIVATE_NOFOCUS

The view is losing the input focus.

SVUIA_DEACTIVATE

Explorer is about to destroy the view window.

SVUIA_INPLACEACTIVATE

This is not used for this interface.

11.4.4 IEnumIDList

IEnumIDList enumerates the contents of a shell folder. The methods that compose this interface are listed in Table 11.4.

Table11.4. IEnumIDList Methods

Method

Description

Clone

Creates a clone of the current enumeration object.

Next

Retrieves the specified number of item identifiers.

Reset

Returns to the beginning of the enumeration.

Skip

Skips the specified number of items.

The primary method of this interface is Next . The namespace object is responsible for creating PIDLs that identify the contents of the currently selected folder. When the shell is ready for these PIDLs, it repeatedly calls Next . This method simply returns the next PIDL in an internal list of PIDLs that is maintained by the namespace extension. The complete IDL listing for IEnumIDList can be found in Example 11.4.

Example 11.4. IEnumIDList
 [     uuid(000214f2-0000-0000-c000-000000000046),     helpstring("IEnumIDList Interface"),     odl ] interface IEnumIDList: IUnknown {     HRESULT Next([in] ULONG celt,                   [in,out] LPITEMIDLIST *rgelt,                   [in,out] ULONG *pceltFetched);     HRESULT Skip([in] ULONG celt);     HRESULT Reset(  );     HRESULT Clone([in,out] IEnumIDList **ppenum); } 

11.4.5 Additional Interfaces

There are two additional interfaces that you will use (as opposed to implement) when you create a namespace extension: IShellBrowser and IMalloc . IShellBrowser is derived from IOleWindow and is used to add menu items and toolbar buttons to the Explorer frame window, as well as to display text in the status bar (among other things).

IMalloc is used to allocate and manage memory associated with PIDLs. For those of you who program in C/C++, you can think of this interface as the COM version of malloc and realloc .

We will not get into the gory details of these two interfaces except where necessary. Table 11.5 and Table 11.6 summarize these two interfaces.

Table11.5. IMalloc Interface

Method

Description

Alloc

Allocates a block of memory.

Realloc

Reallocates a block of memory.

Free

Frees an allocated block of memory.

GetSize

Returns the size of a block of allocated memory.

DidAlloc

Determines whether IMalloc was used to allocate the specified block of memory.

HeapMinimize

Minimizes the heap by releasing unused blocks of memory.

Table11.6. IShellBrowser Interface

Method

Description

BrowseObject

Tells Explorer to browse in another folder.

EnableModelessSB

Enables or disables Explorer's modeless windows .

GetControlWindow

Gets the window handle to an Explorer control such as the tree view or status bar.

GetViewStateStream

Returns a stream that can be used to read and write the persistent data for a view.

InsertMenusSB

Inserts Explorer's menu items to an empty menu created by the view.

OnViewWindowActive

Notifies Explorer that the view was activated.

QueryActiveShellView

Returns the currently activated view object.

RemoveMenusSB

Notifies the container to remove its items from Explorer's menu. This is in contrast to InsertMenusSB .

SendControlMsg

Sends messages to Explorer controls such as the tree view or status bar.

SetMenuSB

Installs a composite menu in Explorer.

SetStatusTextSB

Sets and displays status bar text.

SetToolbarItems

Adds toolbar items to Explorer's toolbar.

TranslateAcceleratorSB

Translates accelerator keystrokes while the view is active.

Example 11.5 contains the IDL for both interfaces.

Example 11.5. IMalloc and IShellBrowser
 [     uuid(00000002-0000-0000-C000-000000000046),     helpstring("IMalloc Interface"),     odl ] interface IMalloc : IUnknown {     long Alloc([in] ULONG cb);     long Realloc ([in] VOID *pv, [in] ULONG cb);     void Free([in] VOID *pv);     ULONG GetSize([in] VOID *pv);     int DidAlloc([in] VOID *pv);     void HeapMinimize(  ); }     //---------------------------------------------------------     // IShellBrowser     //     // (this interface is actually derived from IOleWindow)     //---------------------------------------------------------     typedef enum {         SBSP_DEFBROWSER             = 0x0000,         SBSP_SAMEBROWSER            = 0x0001,         SBSP_NEWBROWSER             = 0x0002,         SBSP_DEFMODE                = 0x0000,         SBSP_OPENMODE               = 0x0010,         SBSP_EXPLOREMODE            = 0x0020,         SBSP_ABSOLUTE               = 0x0000,         SBSP_RELATIVE               = 0x1000,         SBSP_PARENT                 = 0x2000,         SBSP_NAVIGATEBACK           = 0x4000,         SBSP_NAVIGATEFORWARD        = 0x8000,         SBSP_ALLOW_AUTONAVIGATE     = 0x10000,         SBSP_INITIATEDBYHLINKFRAME  = 0x80000000,         SBSP_REDIRECT               = 0x40000000,         SBSP_WRITENOHISTORY         = 0x08000000,         SBSP_NOAUTOSELECT           = 0x04000000     } SBSP_BROWSER;     [         uuid(000214e2-0000-0000-c000-000000000046),         helpstring("IShellBrowser Interface"),         odl     ]     interface IShellBrowser : IUnknown     {         // IOleWindow         HRESULT GetWindow([out, retval] HWND * lphwnd);         HRESULT ContextSensitiveHelp([in] BOOL fEnterMode);              // IShellBrowser         HRESULT InsertMenusSB(                      [in] HMENU hmenuShared,                       [in] LPOLEMENUGROUPWIDTHS lpMenuWidths);         HRESULT SetMenuSB([in] HMENU hmenuShared,                            [in] HOLEMENU holemenuReserved,                            [in] HWND hwndActiveObject);         HRESULT RemoveMenusSB([in] HMENU hmenuShared);         HRESULT SetStatusTextSB([in] LPCOLESTR lpszStatusText);         HRESULT EnableModelessSB([in] BOOL fEnable);         HRESULT TranslateAcceleratorSB([in] LPMSG lpmsg,                                         [in] WORD wID);         HRESULT BrowseObject([in] LPCITEMIDLIST pidl,                               [in] SBSP_BROWSER wFlags);         HRESULT GetViewStateStream([in] DWORD grfMode,                                     [in, out] LPSTREAM  *ppStrm);         HRESULT GetControlWindow([in] UINT id,                                   [out, retval] HWND * lphwnd);         HRESULT SendControlMsg([in] UINT id,                                 [in] UINT uMsg,                                 [in] WPARAM wParam,                                [in] LPARAM lParam,                                 [out, retval] LRESULT * pret);         HRESULT QueryActiveShellView(                              [out, retval] IShellView ** ppshv);         HRESULT OnViewWindowActive([in] IShellView * ppshv);         HRESULT SetToolbarItems([in] LPTBBUTTON lpButtons,                                  [in] UINT nButtons,                                 [in] UINT uFlags);     } 
only for RuBoard - do not distribute or recompile


Visual Basic Shell Programming
Visual Basic Shell Programming
ISBN: B00007FY99
EAN: N/A
Year: 2000
Pages: 128

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net