📄 shlobj.h
字号:
UINT uFlags) PURE;
STDMETHOD(InvokeCommand)(THIS_
LPCMINVOKECOMMANDINFO lpici) PURE;
STDMETHOD(GetCommandString)(THIS_
UINT idCmd,
UINT uType,
UINT * pwReserved,
LPSTR pszName,
UINT cchMax) PURE;
};
typedef IContextMenu * LPCONTEXTMENU;
//
// IContextMenu2 (IContextMenu with one new member)
//
// IContextMenu2::HandleMenuMsg
//
// This function is called, if the client of IContextMenu is aware of
// IContextMenu2 interface and receives one of following messages while
// it is calling TrackPopupMenu (in the window proc of hwndOwner):
// WM_INITPOPUP, WM_DRAWITEM and WM_MEASUREITEM
// The callee may handle these messages to draw owner draw menuitems.
//
#undef INTERFACE
#define INTERFACE IContextMenu2
DECLARE_INTERFACE_(IContextMenu2, IUnknown)
{
// *** IUnknown methods ***
STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
STDMETHOD(QueryContextMenu)(THIS_
HMENU hmenu,
UINT indexMenu,
UINT idCmdFirst,
UINT idCmdLast,
UINT uFlags) PURE;
STDMETHOD(InvokeCommand)(THIS_
LPCMINVOKECOMMANDINFO lpici) PURE;
STDMETHOD(GetCommandString)(THIS_
UINT idCmd,
UINT uType,
UINT * pwReserved,
LPSTR pszName,
UINT cchMax) PURE;
STDMETHOD(HandleMenuMsg)(THIS_
UINT uMsg,
WPARAM wParam,
LPARAM lParam) PURE;
};
typedef IContextMenu2 * LPCONTEXTMENU2;
//===========================================================================
//
// Interface: IShellExtInit
//
// The IShellExtInit interface is used by the explorer to initialize shell
// extension objects. The explorer (1) calls CoCreateInstance (or equivalent)
// with the registered CLSID and IID_IShellExtInit, (2) calls its Initialize
// member, then (3) calls its QueryInterface to a particular interface (such
// as IContextMenu or IPropSheetExt and (4) performs the rest of operation.
//
//
// [Member functions]
//
// IShellExtInit::Initialize
//
// This member function is called when the explorer is initializing either
// context menu extension, property sheet extension or non-default drag-drop
// extension.
//
// Parameters: (context menu or property sheet extension)
// pidlFolder -- Specifies the parent folder
// lpdobj -- Spefifies the set of items selected in that folder.
// hkeyProgID -- Specifies the type of the focused item in the selection.
//
// Parameters: (non-default drag-and-drop extension)
// pidlFolder -- Specifies the target (destination) folder
// lpdobj -- Specifies the items that are dropped (see the description
// about shell's clipboard below for clipboard formats).
// hkeyProgID -- Specifies the folder type.
//
//===========================================================================
#undef INTERFACE
#define INTERFACE IShellExtInit
DECLARE_INTERFACE_(IShellExtInit, IUnknown)
{
// *** IUnknown methods ***
STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
// *** IShellExtInit methods ***
STDMETHOD(Initialize)(THIS_ LPCITEMIDLIST pidlFolder,
LPDATAOBJECT lpdobj, HKEY hkeyProgID) PURE;
};
typedef IShellExtInit * LPSHELLEXTINIT;
//===========================================================================
//
// Interface: IShellPropSheetExt
//
// The explorer uses the IShellPropSheetExt to allow property sheet
// extensions or control panel extensions to add additional property
// sheet pages.
//
//
// [Member functions]
//
// IShellPropSheetExt::AddPages
//
// The explorer calls this member function when it finds a registered
// property sheet extension for a particular type of object. For each
// additional page, the extension creates a page object by calling
// CreatePropertySheetPage API and calls lpfnAddPage.
//
// Parameters:
// lpfnAddPage -- Specifies the callback function.
// lParam -- Specifies the opaque handle to be passed to the callback function.
//
//
// IShellPropSheetExt::ReplacePage
//
// The explorer never calls this member of property sheet extensions. The
// explorer calls this member of control panel extensions, so that they
// can replace some of default control panel pages (such as a page of
// mouse control panel).
//
// Parameters:
// uPageID -- Specifies the page to be replaced.
// lpfnReplace Specifies the callback function.
// lParam -- Specifies the opaque handle to be passed to the callback function.
//
//===========================================================================
#undef INTERFACE
#define INTERFACE IShellPropSheetExt
DECLARE_INTERFACE_(IShellPropSheetExt, IUnknown)
{
// *** IUnknown methods ***
STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
// *** IShellPropSheetExt methods ***
STDMETHOD(AddPages)(THIS_ LPFNADDPROPSHEETPAGE lpfnAddPage, LPARAM lParam) PURE;
STDMETHOD(ReplacePage)(THIS_ UINT uPageID, LPFNADDPROPSHEETPAGE lpfnReplaceWith, LPARAM lParam) PURE;
};
typedef IShellPropSheetExt * LPSHELLPROPSHEETEXT;
//===========================================================================
//
// IPersistFolder Interface
//
// The IPersistFolder interface is used by the file system implementation of
// IShellFolder::BindToObject when it is initializing a shell folder object.
//
//
// [Member functions]
//
// IPersistFolder::Initialize
//
// This member function is called when the explorer is initializing a
// shell folder object.
//
// Parameters:
// pidl -- Specifies the absolute location of the folder.
//
//===========================================================================
#undef INTERFACE
#define INTERFACE IPersistFolder
DECLARE_INTERFACE_(IPersistFolder, IPersist) // fld
{
// *** IUnknown methods ***
STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE;
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
STDMETHOD_(ULONG,Release)(THIS) PURE;
// *** IPersist methods ***
STDMETHOD(GetClassID)(THIS_ LPCLSID lpClassID) PURE;
// *** IPersistFolder methods ***
STDMETHOD(Initialize)(THIS_ LPCITEMIDLIST pidl) PURE;
};
typedef IPersistFolder *LPPERSISTFOLDER;
//===========================================================================
//
// IExtractIcon interface
//
// This interface is used in two different places in the shell.
//
// Case-1: Icons of sub-folders for the scope-pane of the explorer.
//
// It is used by the explorer to get the "icon location" of
// sub-folders from each shell folders. When the user expands a folder
// in the scope pane of the explorer, the explorer does following:
// (1) binds to the folder (gets IShellFolder),
// (2) enumerates its sub-folders by calling its EnumObjects member,
// (3) calls its GetUIObjectOf member to get IExtractIcon interface
// for each sub-folders.
// In this case, the explorer uses only IExtractIcon::GetIconLocation
// member to get the location of the appropriate icon. An icon location
// always consists of a file name (typically DLL or EXE) and either an icon
// resource or an icon index.
//
//
// Case-2: Extracting an icon image from a file
//
// It is used by the shell when it extracts an icon image
// from a file. When the shell is extracting an icon from a file,
// it does following:
// (1) creates the icon extraction handler object (by getting its CLSID
// under the {ProgID}\shell\ExtractIconHanler key and calling
// CoCreateInstance requesting for IExtractIcon interface).
// (2) Calls IExtractIcon::GetIconLocation.
// (3) Then, calls IExtractIcon::ExtractIcon with the location/index pair.
// (4) If (3) returns NOERROR, it uses the returned icon.
// (5) Otherwise, it recursively calls this logic with new location
// assuming that the location string contains a fully qualified path name.
//
// From extension programmer's point of view, there are only two cases
// where they provide implementations of IExtractIcon:
// Case-1) providing explorer extensions (i.e., IShellFolder).
// Case-2) providing per-instance icons for some types of files.
//
// Because Case-1 is described above, we'll explain only Case-2 here.
//
// When the shell is about display an icon for a file, it does following:
// (1) Finds its ProgID and ClassID.
// (2) If the file has a ClassID, it gets the icon location string from the
// "DefaultIcon" key under it. The string indicates either per-class
// icon (e.g., "FOOBAR.DLL,2") or per-instance icon (e.g., "%1,1").
// (3) If a per-instance icon is specified, the shell creates an icon
// extraction handler object for it, and extracts the icon from it
// (which is described above).
//
// It is important to note that the shell calls IExtractIcon::GetIconLocation
// first, then calls IExtractIcon::Extract. Most application programs
// that support per-instance icons will probably store an icon location
// (DLL/EXE name and index/id) rather than an icon image in each file.
// In those cases, a programmer needs to implement only the GetIconLocation
// member and it Extract member simply returns S_FALSE. They need to
// implement Extract member only if they decided to store the icon images
// within files themselved or some other database (which is very rare).
//
//
//
// [Member functions]
//
//
// IExtractIcon::GetIconLocation
//
// This function returns an icon location.
//
// Parameters:
// uFlags [in] -- Specifies if it is opened or not (GIL_OPENICON or 0)
// szIconFile [out] -- Specifies the string buffer buffer for a location name.
// cchMax [in] -- Specifies the size of szIconFile (almost always MAX_PATH)
// piIndex [out] -- Sepcifies the address of UINT for the index.
// pwFlags [out] -- Returns GIL_* flags
// Returns:
// NOERROR, if it returns a valid location; S_FALSE, if the shell use a
// default icon.
//
// Notes: The location may or may not be a path to a file. The caller can
// not assume anything unless the subsequent Extract member call returns
// S_FALSE.
//
// if the returned location is not a path to a file, GIL_NOTFILENAME should
// be set in the returned flags.
//
// IExtractIcon::Extract
//
// This function extracts an icon image from a specified file.
//
// Parameters:
// pszFile [in] -- Specifies the icon location (typically a path to a file).
// nIconIndex [in] -- Specifies the icon index.
// phiconLarge [out] -- Specifies the HICON variable for large icon.
// phiconSmall [out] -- Specifies the HICON variable for small icon.
// nIconSize [in] -- Specifies the size icon required (size of large icon)
// LOWORD is the requested large icon size
// HIWORD is the requested small icon size
// Returns:
// NOERROR, if it extracted the from the file.
// S_FALSE, if the caller should extract from the file specified in the
// location.
//
//===========================================================================
// GetIconLocation() input flags
#define GIL_OPENICON 0x0001 // allows containers to specify an "open" look
#define GIL_FORSHELL 0x0002 // icon is to be displayed in a ShellFolder
// GetIconLocation() return flags
#define GIL_SIMULATEDOC 0x0001 // simulate this document icon for this
#define GIL_PERINSTANCE 0x0002 // icons from this class are per instance (each file has its own)
#define GIL_PERCLASS 0x0004 // icons from this class per class (shared for all files of this type)
#define GIL_NOTFILENAME 0x0008 // location is not a filename, must call ::ExtractIcon
#define GIL_DONTCACHE 0x0010 // this icon should not be cached
#undef INTERFACE
#define INTERFACE IExtractIconA
DECLARE_INTERFACE_(IExtractIconA, IUnknown) // exic
{
// *** IUnknown methods ***
STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
// *** IExtractIcon methods ***
STDMETHOD(GetIconLocation)(THIS_
UINT uFlags,
LPSTR szIconFile,
UINT cchMax,
int * piIndex,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -