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.

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.

Table 11-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);
}

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 ...

Get VB Shell Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.