📄 shlobj.h
字号:
//
//
// 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
#define GIL_ASYNC 0x0020 // this is an async extract, return E_PENDING
#define GIL_DEFAULTICON 0x0040 // get the default icon location if the final one takes too long to get
#define GIL_FORSHORTCUT 0x0080 // the icon is for a shortcut to the object
// 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, void **ppv) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
// *** IExtractIcon methods ***
STDMETHOD(GetIconLocation)(THIS_
UINT uFlags,
LPSTR szIconFile,
UINT cchMax,
int * piIndex,
UINT * pwFlags) PURE;
STDMETHOD(Extract)(THIS_
LPCSTR pszFile,
UINT nIconIndex,
HICON *phiconLarge,
HICON *phiconSmall,
UINT nIconSize) PURE;
};
typedef IExtractIconA * LPEXTRACTICONA;
#undef INTERFACE
#define INTERFACE IExtractIconW
DECLARE_INTERFACE_(IExtractIconW, IUnknown) // exic
{
// *** IUnknown methods ***
STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
// *** IExtractIcon methods ***
STDMETHOD(GetIconLocation)(THIS_
UINT uFlags,
LPWSTR szIconFile,
UINT cchMax,
int * piIndex,
UINT * pwFlags) PURE;
STDMETHOD(Extract)(THIS_
LPCWSTR pszFile,
UINT nIconIndex,
HICON *phiconLarge,
HICON *phiconSmall,
UINT nIconSize) PURE;
};
typedef IExtractIconW * LPEXTRACTICONW;
#ifdef UNICODE
#define IExtractIcon IExtractIconW
#define IExtractIconVtbl IExtractIconWVtbl
#define LPEXTRACTICON LPEXTRACTICONW
#else
#define IExtractIcon IExtractIconA
#define IExtractIconVtbl IExtractIconAVtbl
#define LPEXTRACTICON LPEXTRACTICONA
#endif
//===========================================================================
//
// IShellIcon Interface
//
// used to get a icon index for a IShellFolder object.
//
// this interface can be implemented by a IShellFolder, as a quick way to
// return the icon for a object in the folder.
//
// a instance of this interface is only created once for the folder, unlike
// IExtractIcon witch is created once for each object.
//
// if a ShellFolder does not implement this interface, the standard
// GetUIObject(....IExtractIcon) method will be used to get a icon
// for all objects.
//
// the following standard imagelist indexs can be returned:
//
// 0 document (blank page) (not associated)
// 1 document (with stuff on the page)
// 2 application (exe, com, bat)
// 3 folder (plain)
// 4 folder (open)
//
// IShellIcon:GetIconOf(pidl, flags, lpIconIndex)
//
// pidl object to get icon for.
// flags GIL_* input flags (GIL_OPEN, ...)
// lpIconIndex place to return icon index.
//
// returns:
// NOERROR, if lpIconIndex contains the correct system imagelist index.
// S_FALSE, if unable to get icon for this object, go through
// GetUIObject, IExtractIcon, methods.
//
//===========================================================================
#undef INTERFACE
#define INTERFACE IShellIcon
DECLARE_INTERFACE_(IShellIcon, IUnknown) // shi
{
// *** IUnknown methods ***
STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
// *** IShellIcon methods ***
STDMETHOD(GetIconOf)(THIS_ LPCITEMIDLIST pidl, UINT flags,
LPINT lpIconIndex) PURE;
};
typedef IShellIcon *LPSHELLICON;
//===========================================================================
//
// IShellIconOverlayIdentifier
//
// Used to identify a file as a member of the group of files that have this specific
// icon overlay
//
// Users can create new IconOverlayIdentifiers and place them in the following registry
// location together with the Icon overlay image and their priority.
// HKEY_LOCAL_MACHINE "Software\\Microsoft\\Windows\\CurrentVersion\\ShellIconOverlayIdentifiers"
//
// The shell will enumerate through all IconOverlayIdentifiers at start, and prioritize
// them according to internal rules, in case the internal rules don't apply, we use their
// input priority
//
// IShellIconOverlayIdentifier:IsMemberOf(LPCWSTR pwszPath, DWORD dwAttrib)
// pwszPath full path of the file
// dwAttrib attribute of this file
//
// returns:
// S_OK, if the file is a member
// S_FALSE, if the file is not a member
// E_FAIL, if the operation failed due to bad WIN32_FIND_DATA
//
// IShellIconOverlayIdentifier::GetOverlayInfo(LPWSTR pwszIconFile, int * pIndex, DWORD * dwFlags) PURE;
// pszIconFile the path of the icon file
// pIndex Depend on the flags, this could contain the IconIndex
// dwFlags defined below
//
// IShellIconOverlayIdentifier::GetPriority(int * pIPriority) PURE;
// pIPriority the priority of this Overlay Identifier
//
//===========================================================================
#undef INTERFACE
#define INTERFACE IShellIconOverlayIdentifier
DECLARE_INTERFACE_(IShellIconOverlayIdentifier, IUnknown)
{
// *** IUnknown methods ***
STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
// *** IShellIconOverlayIdentifier methods ***
STDMETHOD (IsMemberOf)(THIS_ LPCWSTR pwszPath, DWORD dwAttrib) PURE;
STDMETHOD (GetOverlayInfo)(THIS_ LPWSTR pwszIconFile, int cchMax, int * pIndex, DWORD * pdwFlags) PURE;
STDMETHOD (GetPriority)(THIS_ int * pIPriority) PURE;
};
#define ISIOI_ICONFILE 0x00000001 // path is returned through pwszIconFile
#define ISIOI_ICONINDEX 0x00000002 // icon index in pwszIconFile is returned through pIndex
//===========================================================================
//
// IShellIconOverlayManager
//
// Used to return the icon overlay information including OverlayIndex, Image Index or Priority for an IShellFolder object.
//
// IShellIconOverlayManager:GetFileOverlayInfo(LPCWSTR pwszPath, DWORD dwAttrib, int * pIndex, DWORD dwflags)
// pwszPath full path of the file
// dwAttrib attribute of this file
// pIndex pointer to the Icon Index in the system image list
// pOverlayIndex pointer to the OverlayIndex in the system image list
// pPriority pointer to the Priority of this overlay
// IShellIconOverlayManager:GetReservedOverlayInfo(LPCWSTR pwszPath, DWORD dwAttrib, int * pIndex, DWORD dwflags, int iReservedID)
// iReservedID reserved icon overlay id
// returns:
// S_OK, if the index of an Overlay is found
// S_FALSE, if no Overlay exists for this file
// E_FAIL, if lpfd is bad
// IShellIconOverlayManager:RefreshOverlayImages(DWORD dwFlags)
// This will refresh the overlay cache, depends on the dwFlags passed in
// It will reload the icons into the imagelist, when passed SIOM_ICONINDEX
// IShellIconOverlayManager::LoadNonloadedOverlayIdentifiers()
// This method loads any registered overlay identifiers (handlers) that
// are not currently loaded.
// IShellIconOverlayManager::OverlayIndexFromImageIndex(int iImage, int *piIndex, BOOL fAdd)
// iImage existing shell image list index to look for
// piIndex returned overlay index
// fAdd Add image if not already present?
//===========================================================================
#if (_WIN32_IE >= 0x0601)
#undef INTERFACE
#define INTERFACE IShellIconOverlayManager
DECLARE_INTERFACE_(IShellIconOverlayManager, IUnknown)
{
// *** IUnknown methods ***
STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
// *** IShellIconOverlayManager methods ***
STDMETHOD(GetFileOverlayInfo)(THIS_ LPCWSTR pwszPath, DWORD dwAttrib, int * pIndex, DWORD dwflags) PURE;
STDMETHOD(GetReservedOverlayInfo)(THIS_ LPCWSTR pwszPath, DWORD dwAttrib, int * pIndex, DWORD dwflags, int iReservedID) PURE;
STDMETHOD(RefreshOverlayImages)(THIS_ DWORD dwFlags) PURE;
STDMETHOD(LoadNonloadedOverlayIdentifiers)(THIS) PURE;
STDMETHOD(OverlayIndexFromImageIndex)(THIS_ int iImage, int * piIndex, BOOL fAdd) PURE;
};
#define SIOM_OVERLAYINDEX 1
#define SIOM_ICONINDEX 2
// #define SIOM_PRIORITY 3
#define SIOM_RESERVED_SHARED 0
#define SIOM_RESERVED_LINK 1
#define SIOM_RESERVED_SLOWFILE 2
#endif // (_WIN32_IE >= 0x0601)
//===========================================================================
//
// IShellIconOverlay
//
// Used to return the icon overlay index or its icon index for an IShellFolder object,
// this is always implemented with IShellFolder
//
// IShellIconOverlay:GetOverlayIndex(LPCITEMIDLIST pidl, DWORD * pdwIndex)
// pidl object to identify icon overlay for.
// pdwIndex the Overlay Index in the system image list
//
// IShellIconOverlay:GetOverlayIconIndex(LPCITEMIDLIST pidl, DWORD * pdwIndex)
// pdwIconIndex the Overlay Icon index in the system image list
// This method is only used for those who are interested in seeing the real bits
// of the Overlay Icon
//
// returns:
// S_OK, if the index of an Overlay is found
// S_FALSE, if no Overlay exists for this file
// E_FAIL, if pidl is bad
//
//===========================================================================
#undef INTERFACE
#define INTERFACE IShellIconOverlay
DECLARE_INTERFACE_(IShellIconOverlay, IUnknown)
{
// *** IUnknown methods ***
STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
// *** IShellIconOverlay methods ***
STDMETHOD(GetOverlayIndex)(THIS_ LPCITEMIDLIST pidl, int * pIndex) PURE;
STDMETHOD(GetOverlayIconIndex)(THIS_ LPCITEMIDLIST pidl, int * pIconIndex) PURE;
};
#define OI_ASYNC 0xFFFFEEEE
//-------------------------------------------------------------------------
//
// SHGetIconOverlayIndex
//
// This function takes the path and icon/res id to the icon and convert it into
// an overlay index in the system image list.
// Note: there are totally only 15 slots for system image overlays, some of which
// was reserved by the system, or taken by the overlayidentifiers, so it's possible
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -