ShlObj.h
上传用户:dzyhzl
上传日期:2019-04-29
资源大小:56270k
文件大小:141k
- //===========================================================================
- //
- // Copyright (c) Microsoft Corporation. All rights reserved.
- //
- // File: shlobj.h
- //
- //===========================================================================
- #ifndef _SHLOBJ_H_
- #define _SHLOBJ_H_
- #ifndef _WINRESRC_
- #ifndef _WIN32_IE
- #define _WIN32_IE 0x0501
- #else
- #if (_WIN32_IE < 0x0400) && defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0500)
- #error _WIN32_IE setting conflicts with _WIN32_WINNT setting
- #endif
- #endif
- #endif
- #ifndef SNDMSG
- #ifdef __cplusplus
- #define SNDMSG ::SendMessage
- #else
- #define SNDMSG SendMessage
- #endif
- #endif // ifndef SNDMSG
- //
- // Define API decoration for direct importing of DLL references.
- //
- #ifndef WINSHELLAPI
- #if defined(_SHELL32_)
- #define WINSHELLAPI
- #else
- #define WINSHELLAPI DECLSPEC_IMPORT
- #endif
- #endif // WINSHELLAPI
- #ifndef SHSTDAPI
- #if defined(_SHELL32_)
- #define SHSTDAPI STDAPI
- #define SHSTDAPI_(type) STDAPI_(type)
- #else
- #define SHSTDAPI EXTERN_C DECLSPEC_IMPORT HRESULT STDAPICALLTYPE
- #define SHSTDAPI_(type) EXTERN_C DECLSPEC_IMPORT type STDAPICALLTYPE
- #endif
- #endif // SHSTDAPI
- #ifndef SHDOCAPI
- #if defined(_SHDOCVW_)
- #define SHDOCAPI STDAPI
- #define SHDOCAPI_(type) STDAPI_(type)
- #else
- #define SHDOCAPI EXTERN_C DECLSPEC_IMPORT HRESULT STDAPICALLTYPE
- #define SHDOCAPI_(type) EXTERN_C DECLSPEC_IMPORT type STDAPICALLTYPE
- #endif
- #endif // SHDOCAPI
- // shell32 APIs that are also exported from shdocvw
- #ifndef SHSTDDOCAPI
- #if defined(_SHDOCVW_) || defined(_SHELL32_)
- #define SHSTDDOCAPI STDAPI
- #define SHSTDDOCAPI_(type) STDAPI_(type)
- #else
- #define SHSTDDOCAPI EXTERN_C DECLSPEC_IMPORT HRESULT STDAPICALLTYPE
- #define SHSTDDOCAPI_(type) EXTERN_C DECLSPEC_IMPORT type STDAPICALLTYPE
- #endif
- #endif // SHSTDDOCAPI
- #ifndef BROWSEUIAPI
- #if defined(_BROWSEUI_)
- #define BROWSEUIAPI STDAPI
- #define BROWSEUIAPI_(type) STDAPI_(type)
- #else
- #define BROWSEUIAPI EXTERN_C DECLSPEC_IMPORT HRESULT STDAPICALLTYPE
- #define BROWSEUIAPI_(type) EXTERN_C DECLSPEC_IMPORT type STDAPICALLTYPE
- #endif // defined(_BROWSEUI_)
- #endif // BROWSEUIAPI
- // shell32 APIs that are also exported from shfolder
- #ifndef SHFOLDERAPI
- #if defined(_SHFOLDER_) || defined(_SHELL32_)
- #define SHFOLDERAPI STDAPI
- #else
- #define SHFOLDERAPI EXTERN_C DECLSPEC_IMPORT HRESULT STDAPICALLTYPE
- #endif
- #endif
- #include <ole2.h>
- #ifndef _PRSHT_H_
- #include <prsht.h>
- #endif
- #ifndef _INC_COMMCTRL
- #include <commctrl.h> // for LPTBBUTTON
- #endif
- #ifndef INITGUID
- #include <shlguid.h>
- #endif /* !INITGUID */
- #include <pshpack1.h> /* Assume byte packing throughout */
- #ifdef __cplusplus
- extern "C" { /* Assume C declarations for C++ */
- #endif /* __cplusplus */
- #include <shtypes.h>
- #include <shobjidl.h>
- //===========================================================================
- //
- // Task allocator API
- //
- // All the shell extensions MUST use the task allocator (see OLE 2.0
- // programming guild for its definition) when they allocate or free
- // memory objects (mostly ITEMIDLIST) that are returned across any
- // shell interfaces. There are two ways to access the task allocator
- // from a shell extension depending on whether or not it is linked with
- // OLE32.DLL or not (purely for efficiency).
- //
- // (1) A shell extension which calls any OLE API (i.e., linked with
- // OLE32.DLL) should call OLE's task allocator (by retrieving
- // the task allocator by calling CoGetMalloc API).
- //
- // (2) A shell extension which does not call any OLE API (i.e., not linked
- // with OLE32.DLL) should call the shell task allocator API (defined
- // below), so that the shell can quickly loads it when OLE32.DLL is not
- // loaded by any application at that point.
- //
- // Notes:
- // In next version of Windowso release, SHGetMalloc will be replaced by
- // the following macro.
- //
- // #define SHGetMalloc(ppmem) CoGetMalloc(MEMCTX_TASK, ppmem)
- //
- //===========================================================================
- SHSTDAPI SHGetMalloc(LPMALLOC * ppMalloc);
- //===========================================================================
- //
- // IContextMenu interface
- //
- // [OverView]
- //
- // The shell uses the IContextMenu interface in following three cases.
- //
- // case-1: The shell is loading context menu extensions.
- //
- // When the user clicks the right mouse button on an item within the shell's
- // name space (i.g., file, directory, server, work-group, etc.), it creates
- // the default context menu for its type, then loads context menu extensions
- // that are registered for that type (and its base type) so that they can
- // add extra menu items. Those context menu extensions are registered at
- // HKCR{ProgID}shellexContextMenuHandlers.
- //
- // case-2: The shell is retrieving a context menu of sub-folders in extended
- // name-space.
- //
- // When the explorer's name space is extended by name space extensions,
- // the shell calls their IShellFolder::GetUIObjectOf to get the IContextMenu
- // objects when it creates context menus for folders under those extended
- // name spaces.
- //
- // case-3: The shell is loading non-default drag and drop handler for directories.
- //
- // When the user performed a non-default drag and drop onto one of file
- // system folders (i.e., directories), it loads shell extensions that are
- // registered at HKCR{ProgID}DragDropHandlers.
- //
- //
- // [Member functions]
- //
- //
- // IContextMenu::QueryContextMenu
- //
- // This member function may insert one or more menuitems to the specified
- // menu (hmenu) at the specified location (indexMenu which is never be -1).
- // The IDs of those menuitem must be in the specified range (idCmdFirst and
- // idCmdLast). It returns the maximum menuitem ID offset (ushort) in the
- // 'code' field (low word) of the scode.
- //
- // The uFlags specify the context. It may have one or more of following
- // flags.
- //
- // CMF_DEFAULTONLY: This flag is passed if the user is invoking the default
- // action (typically by double-clicking, case 1 and 2 only). Context menu
- // extensions (case 1) should not add any menu items, and returns NOERROR.
- //
- // CMF_VERBSONLY: The explorer passes this flag if it is constructing
- // a context menu for a short-cut object (case 1 and case 2 only). If this
- // flag is passed, it should not add any menu-items that is not appropriate
- // from a short-cut.
- // A good example is the "Delete" menuitem, which confuses the user
- // because it is not clear whether it deletes the link source item or the
- // link itself.
- //
- // CMF_EXPLORER: The explorer passes this flag if it has the left-side pane
- // (case 1 and 2 only). Context menu extensions should ignore this flag.
- //
- // High word (16-bit) are reserved for context specific communications
- // and the rest of flags (13-bit) are reserved by the system.
- //
- //
- // IContextMenu::InvokeCommand
- //
- // This member is called when the user has selected one of menuitems that
- // are inserted by previous QueryContextMenu member. In this case, the
- // LOWORD(lpici->lpVerb) contains the menuitem ID offset (menuitem ID -
- // idCmdFirst).
- //
- // This member function may also be called programmatically. In such a case,
- // lpici->lpVerb specifies the canonical name of the command to be invoked,
- // which is typically retrieved by GetCommandString member previously.
- //
- // Parameters in lpci:
- // cbSize -- Specifies the size of this structure (sizeof(*lpci))
- // hwnd -- Specifies the owner window for any message/dialog box.
- // fMask -- Specifies whether or not dwHotkey/hIcon paramter is valid.
- // lpVerb -- Specifies the command to be invoked.
- // lpParameters -- Parameters (optional)
- // lpDirectory -- Working directory (optional)
- // nShow -- Specifies the flag to be passed to ShowWindow (SW_*).
- // dwHotKey -- Hot key to be assigned to the app after invoked (optional).
- // hIcon -- Specifies the icon (optional).
- // hMonitor -- Specifies the default monitor (optional).
- //
- //
- // IContextMenu::GetCommandString
- //
- // This member function is called by the explorer either to get the
- // canonical (language independent) command name (uFlags == GCS_VERB) or
- // the help text ((uFlags & GCS_HELPTEXT) != 0) for the specified command.
- // The retrieved canonical string may be passed to its InvokeCommand
- // member function to invoke a command programmatically. The explorer
- // displays the help texts in its status bar; therefore, the length of
- // the help text should be reasonably short (<40 characters).
- //
- // Parameters:
- // idCmd -- Specifies menuitem ID offset (from idCmdFirst)
- // uFlags -- Either GCS_VERB or GCS_HELPTEXT
- // pwReserved -- Reserved (must pass NULL when calling, must ignore when called)
- // pszName -- Specifies the string buffer.
- // cchMax -- Specifies the size of the string buffer.
- //
- //===========================================================================
- // QueryContextMenu uFlags
- #define CMF_NORMAL 0x00000000
- #define CMF_DEFAULTONLY 0x00000001
- #define CMF_VERBSONLY 0x00000002
- #define CMF_EXPLORE 0x00000004
- #define CMF_NOVERBS 0x00000008
- #define CMF_CANRENAME 0x00000010
- #define CMF_NODEFAULT 0x00000020
- #define CMF_INCLUDESTATIC 0x00000040
- #define CMF_EXTENDEDVERBS 0x00000100 // rarely used verbs
- #define CMF_RESERVED 0xffff0000 // View specific
- // GetCommandString uFlags
- #define GCS_VERBA 0x00000000 // canonical verb
- #define GCS_HELPTEXTA 0x00000001 // help text (for status bar)
- #define GCS_VALIDATEA 0x00000002 // validate command exists
- #define GCS_VERBW 0x00000004 // canonical verb (unicode)
- #define GCS_HELPTEXTW 0x00000005 // help text (unicode version)
- #define GCS_VALIDATEW 0x00000006 // validate command exists (unicode)
- #define GCS_UNICODE 0x00000004 // for bit testing - Unicode string
- #ifdef UNICODE
- #define GCS_VERB GCS_VERBW
- #define GCS_HELPTEXT GCS_HELPTEXTW
- #define GCS_VALIDATE GCS_VALIDATEW
- #else
- #define GCS_VERB GCS_VERBA
- #define GCS_HELPTEXT GCS_HELPTEXTA
- #define GCS_VALIDATE GCS_VALIDATEA
- #endif
- #define CMDSTR_NEWFOLDERA "NewFolder"
- #define CMDSTR_VIEWLISTA "ViewList"
- #define CMDSTR_VIEWDETAILSA "ViewDetails"
- #define CMDSTR_NEWFOLDERW L"NewFolder"
- #define CMDSTR_VIEWLISTW L"ViewList"
- #define CMDSTR_VIEWDETAILSW L"ViewDetails"
- #ifdef UNICODE
- #define CMDSTR_NEWFOLDER CMDSTR_NEWFOLDERW
- #define CMDSTR_VIEWLIST CMDSTR_VIEWLISTW
- #define CMDSTR_VIEWDETAILS CMDSTR_VIEWDETAILSW
- #else
- #define CMDSTR_NEWFOLDER CMDSTR_NEWFOLDERA
- #define CMDSTR_VIEWLIST CMDSTR_VIEWLISTA
- #define CMDSTR_VIEWDETAILS CMDSTR_VIEWDETAILSA
- #endif
- #define CMIC_MASK_HOTKEY SEE_MASK_HOTKEY
- #define CMIC_MASK_ICON SEE_MASK_ICON
- #define CMIC_MASK_FLAG_NO_UI SEE_MASK_FLAG_NO_UI
- #define CMIC_MASK_UNICODE SEE_MASK_UNICODE
- #define CMIC_MASK_NO_CONSOLE SEE_MASK_NO_CONSOLE
- #define CMIC_MASK_HASLINKNAME SEE_MASK_HASLINKNAME
- #define CMIC_MASK_FLAG_SEP_VDM SEE_MASK_FLAG_SEPVDM
- #define CMIC_MASK_HASTITLE SEE_MASK_HASTITLE
- #define CMIC_MASK_ASYNCOK SEE_MASK_ASYNCOK
- #if (_WIN32_IE >= 0x0501)
- #define CMIC_MASK_SHIFT_DOWN 0x10000000
- #define CMIC_MASK_CONTROL_DOWN 0x20000000
- #endif // (_WIN32_IE >= 0x501)
- #if (_WIN32_IE >= 0x0560)
- #define CMIC_MASK_FLAG_LOG_USAGE SEE_MASK_FLAG_LOG_USAGE
- #endif // (_WIN32_IE >= 0x560)
- #if (_WIN32_IE >= 0x0400)
- #define CMIC_MASK_PTINVOKE 0x20000000
- #endif
- #include <pshpack8.h>
- //NOTE: When SEE_MASK_HMONITOR is set, hIcon is treated as hMonitor
- typedef struct _CMINVOKECOMMANDINFO {
- DWORD cbSize; // sizeof(CMINVOKECOMMANDINFO)
- DWORD fMask; // any combination of CMIC_MASK_*
- HWND hwnd; // might be NULL (indicating no owner window)
- LPCSTR lpVerb; // either a string or MAKEINTRESOURCE(idOffset)
- LPCSTR lpParameters; // might be NULL (indicating no parameter)
- LPCSTR lpDirectory; // might be NULL (indicating no specific directory)
- int nShow; // one of SW_ values for ShowWindow() API
- DWORD dwHotKey;
- HANDLE hIcon;
- } CMINVOKECOMMANDINFO, *LPCMINVOKECOMMANDINFO;
- typedef struct _CMInvokeCommandInfoEx {
- DWORD cbSize; // must be sizeof(CMINVOKECOMMANDINFOEX)
- DWORD fMask; // any combination of CMIC_MASK_*
- HWND hwnd; // might be NULL (indicating no owner window)
- LPCSTR lpVerb; // either a string or MAKEINTRESOURCE(idOffset)
- LPCSTR lpParameters; // might be NULL (indicating no parameter)
- LPCSTR lpDirectory; // might be NULL (indicating no specific directory)
- int nShow; // one of SW_ values for ShowWindow() API
- DWORD dwHotKey;
- HANDLE hIcon;
- LPCSTR lpTitle; // For CreateProcess-StartupInfo.lpTitle
- LPCWSTR lpVerbW; // Unicode verb (for those who can use it)
- LPCWSTR lpParametersW; // Unicode parameters (for those who can use it)
- LPCWSTR lpDirectoryW; // Unicode directory (for those who can use it)
- LPCWSTR lpTitleW; // Unicode title (for those who can use it)
- #if (_WIN32_IE >= 0x0400)
- POINT ptInvoke; // Point where it's invoked
- #endif
- } CMINVOKECOMMANDINFOEX, *LPCMINVOKECOMMANDINFOEX;
- #include <poppack.h> /* Return to byte packing */
- #undef INTERFACE
- #define INTERFACE IContextMenu
- DECLARE_INTERFACE_(IContextMenu, IUnknown)
- {
- // *** IUnknown methods ***
- STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) 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_PTR 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 hwnd):
- // 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, IContextMenu)
- {
- // *** IUnknown methods ***
- STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
- STDMETHOD_(ULONG,AddRef) (THIS) PURE;
- STDMETHOD_(ULONG,Release) (THIS) PURE;
- // *** IContextMenu methods ***
- STDMETHOD(QueryContextMenu)(THIS_
- HMENU hmenu,
- UINT indexMenu,
- UINT idCmdFirst,
- UINT idCmdLast,
- UINT uFlags) PURE;
- STDMETHOD(InvokeCommand)(THIS_
- LPCMINVOKECOMMANDINFO lpici) PURE;
- STDMETHOD(GetCommandString)(THIS_
- UINT_PTR idCmd,
- UINT uType,
- UINT * pwReserved,
- LPSTR pszName,
- UINT cchMax) PURE;
- // *** IContextMenu2 methods ***
- STDMETHOD(HandleMenuMsg)(THIS_
- UINT uMsg,
- WPARAM wParam,
- LPARAM lParam) PURE;
- };
- typedef IContextMenu2 * LPCONTEXTMENU2;
- //
- // IContextMenu3 (IContextMenu with one new member)
- //
- // IContextMenu3::HandleMenuMsg2
- //
- // This function is called, if the client of IContextMenu is aware of
- // IContextMenu3 interface and receives a menu message while
- // it is calling TrackPopupMenu (in the window proc of hwnd):
- //
- #undef INTERFACE
- #define INTERFACE IContextMenu3
- DECLARE_INTERFACE_(IContextMenu3, IContextMenu2)
- {
- // *** IUnknown methods ***
- STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
- STDMETHOD_(ULONG,AddRef) (THIS) PURE;
- STDMETHOD_(ULONG,Release) (THIS) PURE;
- // *** IContextMenu methods ***
- STDMETHOD(QueryContextMenu)(THIS_
- HMENU hmenu,
- UINT indexMenu,
- UINT idCmdFirst,
- UINT idCmdLast,
- UINT uFlags) PURE;
- STDMETHOD(InvokeCommand)(THIS_
- LPCMINVOKECOMMANDINFO lpici) PURE;
- STDMETHOD(GetCommandString)(THIS_
- UINT_PTR idCmd,
- UINT uType,
- UINT * pwReserved,
- LPSTR pszName,
- UINT cchMax) PURE;
- // *** IContextMenu2 methods ***
- STDMETHOD(HandleMenuMsg)(THIS_
- UINT uMsg,
- WPARAM wParam,
- LPARAM lParam) PURE;
- // *** IContextMenu3 methods ***
- STDMETHOD(HandleMenuMsg2)(THIS_
- UINT uMsg,
- WPARAM wParam,
- LPARAM lParam,
- LRESULT* plResult) PURE;
- };
- typedef IContextMenu3 * LPCONTEXTMENU3;
- #if (_WIN32_IE >= 0x0500)
- #undef INTERFACE
- #define INTERFACE IPersistFolder3
- #define CSIDL_FLAG_PFTI_TRACKTARGET CSIDL_FLAG_DONT_VERIFY
- // DESCRIPTION: PERSIST_FOLDER_TARGET_INFO
- // This stucture is used for Folder Shortcuts which allow the shell to
- // have a file system folder act like another area in the name space.
- // One of pidlTargetFolder, szTargetParsingName, or csidl needs to
- // specify the destination name space.
- //
- // pidlTargetFolder: This is a full pidl to the target folder. Can be NULL in the IPersistFolder3::InitializeEx()
- // call but not in the GetFolderTargetInfo() return structure.
- // szTargetParsingName: Empty string if not specified. Ortherwise, it is the parsible name
- // to the target. This name can be parsed by IShellFolder::
- // ParsedName() from the desktop.
- // szNetworkProvider: Can be an empty string. If not empty, it specifies the type of network
- // provider that will be used when binding to the target. This is used
- // for performance optimizations for the WNet APIs.
- // dwAttributes: -1 if not known. These are the SFGAO_ flags for IShellFolder::GetAttributesOf()
- // csidl: This is -1 if it's not used. This can be used instead of pidlTargetFolder or
- // szTargetParsingName to indicate the TargetFolder. See the list of CSIDL_ folders
- // below. CSIDL_FLAG_PFTI_TRACKTARGET means that the IShellFolder's target folder
- // should change if the user changes the target of the underlying CSIDL value.
- // You can also pass CSIDL_FLAG_CREATE to indicate that the target folder
- // should be created if it does not exist. No other CSIDL_FLAG_* values are supported.
- #include <pshpack8.h>
- typedef struct
- {
- LPITEMIDLIST pidlTargetFolder; // pidl for the folder we want to intiailize
- WCHAR szTargetParsingName[MAX_PATH]; // optional parsing name for the target
- WCHAR szNetworkProvider[MAX_PATH]; // optional network provider
- DWORD dwAttributes; // optional FILE_ATTRIBUTES_ flags (-1 if not used)
- int csidl; // optional folder index (SHGetFolderPath()) -1 if not used
- } PERSIST_FOLDER_TARGET_INFO;
- #include <poppack.h> /* Return to byte packing */
- // DESCRIPTION: IPersistFolder3
- // This interface is implemented by an IShellFolder object that wants non-default
- // handling of Folder Shortcuts. In general, shell name space extensions should use
- // pidlRoot (the alias pidl) as their location in the name space and pass it to public
- // APIs, such as ShellExecute(). The one exception is that pidlTarget should be used
- // when sending ChangeNotifies or registering to listen for change notifies
- // (see SFVM_GETNOTIFY).
- //
- // InitializeEx: This method initializes an IShellFolder and specifies where
- // it is rooted in the name space.
- // pbc: May be NULL.
- // pidlRoot: This is the same parameter as IPersistFolder::Initialize(). Caller allocates
- // and frees this parameter.
- // ppfti: May be NULL, in which case this is the same as a call to IPersistFolder::Initialize().
- // Otherwise this is a Folder Shortcut and this structure specifies the target
- // folder and it's attributes.
- // GetFolderTargetInfo: This is used by the caller to find information about
- // the folder shortcut. This structure may not be initialized by the caller,
- // so the callee needs to initialize every member. The callee allocates
- // pidlTargetFolder and the caller will free it. Filling in pidlTargetFolder is
- // ALWAYS required.
- DECLARE_INTERFACE_(IPersistFolder3, IPersistFolder2)
- {
- // *** IUnknown methods ***
- STDMETHOD(QueryInterface)(THIS_ REFIID riid, void **ppv) 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;
- // *** IPersistFolder2 methods ***
- STDMETHOD(GetCurFolder)(THIS_ LPITEMIDLIST *ppidl) PURE;
- // *** IPersistFolder3 methods ***
- STDMETHOD(InitializeEx)(THIS_ IBindCtx *pbc, LPCITEMIDLIST pidlRoot, const PERSIST_FOLDER_TARGET_INFO *ppfti) PURE;
- STDMETHOD(GetFolderTargetInfo)(THIS_ PERSIST_FOLDER_TARGET_INFO *ppfti) PURE;
- };
- #endif
- //
- //===========================================================================
- //
- // 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}shellExtractIconHanler 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
- #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
- //===========================================================================
- //
- // 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
- // that this function would fail and return -1;
- //
- // To get the default overlays in the system, such as the share hand, link shortcut
- // and slow files, pass NULL as the file name, then the IDO_SHGIOI_* flags as the icon index
- //-------------------------------------------------------------------------
- #define IDO_SHGIOI_SHARE 0x0FFFFFFF
- #define IDO_SHGIOI_LINK 0x0FFFFFFE
- #define IDO_SHGIOI_SLOWFILE 0x0FFFFFFFD
- SHSTDAPI_(int) SHGetIconOverlayIndexA(LPCSTR pszIconPath, int iIconIndex);
- SHSTDAPI_(int) SHGetIconOverlayIndexW(LPCWSTR pszIconPath, int iIconIndex);
- #ifdef UNICODE
- #define SHGetIconOverlayIndex SHGetIconOverlayIndexW
- #else
- #define SHGetIconOverlayIndex SHGetIconOverlayIndexA
- #endif // !UNICODE
- #if (_WIN32_IE >= 0x0400)
- // IShellLinkDataList::GetFlags()/SetFlags()
- typedef enum {
- SLDF_HAS_ID_LIST = 0x00000001, // Shell link saved with ID list
- SLDF_HAS_LINK_INFO = 0x00000002, // Shell link saved with LinkInfo
- SLDF_HAS_NAME = 0x00000004,
- SLDF_HAS_RELPATH = 0x00000008,
- SLDF_HAS_WORKINGDIR = 0x00000010,
- SLDF_HAS_ARGS = 0x00000020,
- SLDF_HAS_ICONLOCATION = 0x00000040,
- SLDF_UNICODE = 0x00000080, // the strings are unicode
- SLDF_FORCE_NO_LINKINFO = 0x00000100, // don't create a LINKINFO (make a dumb link)
- SLDF_HAS_EXP_SZ = 0x00000200, // the link contains expandable env strings
- SLDF_RUN_IN_SEPARATE = 0x00000400, // Run the 16-bit target exe in a separate VDM/WOW
- SLDF_HAS_LOGO3ID = 0x00000800, // this link is a special Logo3/MSICD link
- SLDF_HAS_DARWINID = 0x00001000, // this link is a special Darwin link
- SLDF_RUNAS_USER = 0x00002000, // Run this link as a different user
- SLDF_HAS_EXP_ICON_SZ = 0x00004000, // contains expandable env string for icon path
- SLDF_NO_PIDL_ALIAS = 0x00008000, // don't ever resolve to a logical location
- SLDF_FORCE_UNCNAME = 0x00010000, // make GetPath() prefer the UNC name to the local name
- SLDF_RUN_WITH_SHIMLAYER = 0x00020000, // Launch the target of this link w/ shim layer active
- SLDF_RESERVED = 0x80000000, // Reserved-- so we can use the low word as an index value in the future
- } SHELL_LINK_DATA_FLAGS;
- typedef struct tagDATABLOCKHEADER
- {
- DWORD cbSize; // Size of this extra data block
- DWORD dwSignature; // signature of this extra data block
- } DATABLOCK_HEADER, *LPDATABLOCK_HEADER, *LPDBLIST;
- typedef struct {
- #ifdef __cplusplus
- DATABLOCK_HEADER dbh;
- #else
- DATABLOCK_HEADER;
- #endif
- WORD wFillAttribute; // fill attribute for console
- WORD wPopupFillAttribute; // fill attribute for console popups
- COORD dwScreenBufferSize; // screen buffer size for console
- COORD dwWindowSize; // window size for console
- COORD dwWindowOrigin; // window origin for console
- DWORD nFont;
- DWORD nInputBufferSize;
- COORD dwFontSize;
- UINT uFontFamily;
- UINT uFontWeight;
- WCHAR FaceName[LF_FACESIZE];
- UINT uCursorSize;
- BOOL bFullScreen;
- BOOL bQuickEdit;
- BOOL bInsertMode;
- BOOL bAutoPosition;
- UINT uHistoryBufferSize;
- UINT uNumberOfHistoryBuffers;
- BOOL bHistoryNoDup;
- COLORREF ColorTable[ 16 ];
- } NT_CONSOLE_PROPS, *LPNT_CONSOLE_PROPS;
- #define NT_CONSOLE_PROPS_SIG 0xA0000002
- // This is a FE Console property
- typedef struct {
- #ifdef __cplusplus
- DATABLOCK_HEADER dbh;
- #else
- DATABLOCK_HEADER;
- #endif
- UINT uCodePage;
- } NT_FE_CONSOLE_PROPS, *LPNT_FE_CONSOLE_PROPS;
- #define NT_FE_CONSOLE_PROPS_SIG 0xA0000004
- #if (_WIN32_IE >= 0x0500)
- typedef struct {
- #ifdef __cplusplus
- DATABLOCK_HEADER dbh;
- #else
- DATABLOCK_HEADER;
- #endif
- CHAR szDarwinID[MAX_PATH]; // ANSI darwin ID associated with link
- WCHAR szwDarwinID[MAX_PATH]; // UNICODE darwin ID associated with link
- } EXP_DARWIN_LINK, *LPEXP_DARWIN_LINK;
- #define EXP_DARWIN_ID_SIG 0xA0000006
- // BUGBUG (reinerf) - this has the same value as EXP_SZ_ICON_SIG?!?!?!
- #define EXP_LOGO3_ID_SIG 0xA0000007
- #endif
- #define EXP_SPECIAL_FOLDER_SIG 0xA0000005 // LPEXP_SPECIAL_FOLDER
- typedef struct
- {
- DWORD cbSize; // Size of this extra data block
- DWORD dwSignature; // signature of this extra data block
- DWORD idSpecialFolder; // special folder id this link points into
- DWORD cbOffset; // ofset into pidl from SLDF_HAS_ID_LIST for child
- } EXP_SPECIAL_FOLDER, *LPEXP_SPECIAL_FOLDER;
- typedef struct
- {
- DWORD cbSize; // Size of this extra data block
- DWORD dwSignature; // signature of this extra data block
- CHAR szTarget[ MAX_PATH ]; // ANSI target name w/EXP_SZ in it
- WCHAR swzTarget[ MAX_PATH ]; // UNICODE target name w/EXP_SZ in it
- } EXP_SZ_LINK, *LPEXP_SZ_LINK;
- #define EXP_SZ_LINK_SIG 0xA0000001 // LPEXP_SZ_LINK (target)
- #define EXP_SZ_ICON_SIG 0xA0000007 // LPEXP_SZ_LINK (icon)
- #undef INTERFACE
- #define INTERFACE IShellLinkDataList
- DECLARE_INTERFACE_(IShellLinkDataList, IUnknown)
- {
- // *** IUnknown methods ***
- STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
- STDMETHOD_(ULONG, AddRef) (THIS) PURE;
- STDMETHOD_(ULONG, Release) (THIS) PURE;
- // *** IShellLinkDataList methods ***
- STDMETHOD(AddDataBlock)(THIS_ void * pDataBlock) PURE;
- STDMETHOD(CopyDataBlock)(THIS_ DWORD dwSig, void **ppDataBlock) PURE;
- STDMETHOD(RemoveDataBlock)(THIS_ DWORD dwSig) PURE;
- STDMETHOD(GetFlags)(THIS_ DWORD *pdwFlags) PURE;
- STDMETHOD(SetFlags)(THIS_ DWORD dwFlags) PURE;
- };
- #endif // (_WIN32_IE >= 0x0400)
- #if (_WIN32_IE >= 0x0500)
- #undef INTERFACE
- #define INTERFACE IResolveShellLink
- DECLARE_INTERFACE_(IResolveShellLink, IUnknown)
- {
- // *** IUnknown methods ***
- STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
- STDMETHOD_(ULONG, AddRef) (THIS) PURE;
- STDMETHOD_(ULONG, Release) (THIS) PURE;
- // *** IResolveShellLink methods ***
- STDMETHOD(ResolveShellLink)(THIS_ IUnknown* punk, HWND hwnd, DWORD fFlags) PURE;
- };
- #endif // (_WIN32_IE >= 0x0500)
- #ifdef _INC_SHELLAPI /* for LPSHELLEXECUTEINFO */
- //===========================================================================
- //
- // IShellExecuteHook Interface
- //
- //===========================================================================
- #undef INTERFACE
- #define INTERFACE IShellExecuteHookA
- DECLARE_INTERFACE_(IShellExecuteHookA, IUnknown) // shexhk
- {
- // *** IUnknown methods ***
- STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
- STDMETHOD_(ULONG, AddRef) (THIS) PURE;
- STDMETHOD_(ULONG, Release) (THIS) PURE;
- // *** IShellExecuteHookA methods ***
- STDMETHOD(Execute)(THIS_ LPSHELLEXECUTEINFOA pei) PURE;
- };
- #undef INTERFACE
- #define INTERFACE IShellExecuteHookW
- DECLARE_INTERFACE_(IShellExecuteHookW, IUnknown) // shexhk
- {
- // *** IUnknown methods ***
- STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
- STDMETHOD_(ULONG, AddRef) (THIS) PURE;
- STDMETHOD_(ULONG, Release) (THIS) PURE;
- // *** IShellExecuteHookW methods ***
- STDMETHOD(Execute)(THIS_ LPSHELLEXECUTEINFOW pei) PURE;
- };
- #ifdef UNICODE
- #define IShellExecuteHook IShellExecuteHookW
- #define IShellExecuteHookVtbl IShellExecuteHookWVtbl
- #else
- #define IShellExecuteHook IShellExecuteHookA
- #define IShellExecuteHookVtbl IShellExecuteHookAVtbl
- #endif
- #endif
- //===========================================================================
- //
- // IURLSearchHook Interface
- //
- //===========================================================================
- #undef INTERFACE
- #define INTERFACE IURLSearchHook
- DECLARE_INTERFACE_(IURLSearchHook, IUnknown)
- {
- // *** IUnknown methods ***
- STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
- STDMETHOD_(ULONG, AddRef) (THIS) PURE;
- STDMETHOD_(ULONG, Release) (THIS) PURE;
- // *** IURLSearchHook methods ***
- STDMETHOD(Translate)(THIS_ LPWSTR lpwszSearchURL, DWORD cchBufferSize) PURE;
- };
- #undef INTERFACE
- #define INTERFACE ISearchContext
- DECLARE_INTERFACE_(ISearchContext, IUnknown)
- {
- // *** IUnknown methods ***
- STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
- STDMETHOD_(ULONG, AddRef) (THIS) PURE;
- STDMETHOD_(ULONG, Release) (THIS) PURE;
- // *** ISearchContext methods ***
- STDMETHOD(GetSearchUrl)(THIS_ BSTR * pbstrSearchUrl) PURE;
- STDMETHOD(GetSearchText)(THIS_ BSTR * pbstrSearchText) PURE;
- STDMETHOD(GetSearchStyle)(THIS_ DWORD * pdwSearchStyle) PURE;
- };
- #undef INTERFACE
- #define INTERFACE IURLSearchHook2
- DECLARE_INTERFACE_(IURLSearchHook2, IURLSearchHook)
- {
- // *** IURLSearchHook2 methods ***
- STDMETHOD(TranslateWithSearchContext)(THIS_ LPWSTR lpwszSearchURL, DWORD cchBufferSize, ISearchContext * pSearchContext) PURE;
- };
- //===========================================================================
- //
- // INewShortcutHook Interface
- //
- //===========================================================================
- #undef INTERFACE
- #define INTERFACE INewShortcutHookA
- DECLARE_INTERFACE_(INewShortcutHookA, IUnknown) // nshhk
- {
- // *** IUnknown methods ***
- STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
- STDMETHOD_(ULONG, AddRef) (THIS) PURE;
- STDMETHOD_(ULONG, Release) (THIS) PURE;
- // *** INewShortcutHook methods ***
- STDMETHOD(SetReferent)(THIS_ LPCSTR pcszReferent, HWND hwnd) PURE;
- STDMETHOD(GetReferent)(THIS_ LPSTR pszReferent, int cchReferent) PURE;
- STDMETHOD(SetFolder)(THIS_ LPCSTR pcszFolder) PURE;
- STDMETHOD(GetFolder)(THIS_ LPSTR pszFolder, int cchFolder) PURE;
- STDMETHOD(GetName)(THIS_ LPSTR pszName, int cchName) PURE;
- STDMETHOD(GetExtension)(THIS_ LPSTR pszExtension, int cchExtension) PURE;
- };
- #undef INTERFACE
- #define INTERFACE INewShortcutHookW
- DECLARE_INTERFACE_(INewShortcutHookW, IUnknown) // nshhk
- {
- // *** IUnknown methods ***
- STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
- STDMETHOD_(ULONG, AddRef) (THIS) PURE;
- STDMETHOD_(ULONG, Release) (THIS) PURE;
- // *** INewShortcutHook methods ***
- STDMETHOD(SetReferent)(THIS_ LPCWSTR pcszReferent, HWND hwnd) PURE;
- STDMETHOD(GetReferent)(THIS_ LPWSTR pszReferent, int cchReferent) PURE;
- STDMETHOD(SetFolder)(THIS_ LPCWSTR pcszFolder) PURE;
- STDMETHOD(GetFolder)(THIS_ LPWSTR pszFolder, int cchFolder) PURE;
- STDMETHOD(GetName)(THIS_ LPWSTR pszName, int cchName) PURE;
- STDMETHOD(GetExtension)(THIS_ LPWSTR pszExtension, int cchExtension) PURE;
- };
- #ifdef UNICODE
- #define INewShortcutHook INewShortcutHookW
- #define INewShortcutHookVtbl INewShortcutHookWVtbl
- #else
- #define INewShortcutHook INewShortcutHookA
- #define INewShortcutHookVtbl INewShortcutHookAVtbl
- #endif
- //===========================================================================
- //
- // ICopyHook Interface
- //
- // The copy hook is called whenever file system directories are
- // copy/moved/deleted/renamed via the shell. It is also called by the shell
- // on changes of status of printers.
- //
- // Clients register their id under STRREG_SHEX_COPYHOOK for file system hooks
- // and STRREG_SHEx_PRNCOPYHOOK for printer hooks.
- // the CopyCallback is called prior to the action, so the hook has the chance
- // to allow, deny or cancel the operation by returning the falues:
- // IDYES - means allow the operation
- // IDNO - means disallow the operation on this file, but continue with
- // any other operations (eg. batch copy)
- // IDCANCEL - means disallow the current operation and cancel any pending
- // operations
- //
- // arguments to the CopyCallback
- // hwnd - window to use for any UI
- // wFunc - what operation is being done
- // wFlags - and flags (FOF_*) set in the initial call to the file operation
- // pszSrcFile - name of the source file
- // dwSrcAttribs - file attributes of the source file
- // pszDestFile - name of the destiation file (for move and renames)
- // dwDestAttribs - file attributes of the destination file
- //
- //
- //===========================================================================
- #ifndef FO_MOVE //these need to be kept in sync with the ones in shellapi.h
- // file operations
- #define FO_MOVE 0x0001
- #define FO_COPY 0x0002
- #define FO_DELETE 0x0003
- #define FO_RENAME 0x0004
- #define FOF_MULTIDESTFILES 0x0001
- #define FOF_CONFIRMMOUSE 0x0002
- #define FOF_SILENT 0x0004 // don't create progress/report
- #define FOF_RENAMEONCOLLISION 0x0008
- #define FOF_NOCONFIRMATION 0x0010 // Don't prompt the user.
- #define FOF_WANTMAPPINGHANDLE 0x0020 // Fill in SHFILEOPSTRUCT.hNameMappings
- // Must be freed using SHFreeNameMappings
- #define FOF_ALLOWUNDO 0x0040
- #define FOF_FILESONLY 0x0080 // on *.*, do only files
- #define FOF_SIMPLEPROGRESS 0x0100 // means don't show names of files
- #define FOF_NOCONFIRMMKDIR 0x0200 // don't confirm making any needed dirs
- #define FOF_NOERRORUI 0x0400 // don't put up error UI
- #define FOF_NOCOPYSECURITYATTRIBS 0x0800 // dont copy NT file Security Attributes
- #define FOF_NORECURSION 0x1000 // don't recurse into directories.
- #if (_WIN32_IE >= 0x500)
- #define FOF_NO_CONNECTED_ELEMENTS 0x2000 // don't operate on connected file elements.
- #define FOF_WANTNUKEWARNING 0x4000 // during delete operation, warn if nuking instead of recycling (partially overrides FOF_NOCONFIRMATION)
- #endif // _WIN32_IE >= 0x500
- #if (_WIN32_WINNT >= 0x0501)
- #define FOF_NORECURSEREPARSE 0x8000 // treat reparse points as objects, not containers
- #endif // (_WIN32_WINNT >= 0x501)
- typedef WORD FILEOP_FLAGS;
- // printer operations
- #define PO_DELETE 0x0013 // printer is being deleted
- #define PO_RENAME 0x0014 // printer is being renamed
- #define PO_PORTCHANGE 0x0020 // port this printer connected to is being changed
- // if this id is set, the strings received by
- // the copyhook are a doubly-null terminated
- // list of strings. The first is the printer
- // name and the second is the printer port.
- #define PO_REN_PORT 0x0034 // PO_RENAME and PO_PORTCHANGE at same time.
- // no POF_ flags currently defined
- typedef UINT PRINTEROP_FLAGS;
- #endif // FO_MOVE
- #undef INTERFACE
- #define INTERFACE ICopyHookA
- DECLARE_INTERFACE_(ICopyHookA, IUnknown) // sl
- {
- // *** IUnknown methods ***
- STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
- STDMETHOD_(ULONG,AddRef) (THIS) PURE;
- STDMETHOD_(ULONG,Release) (THIS) PURE;
- // *** ICopyHook methods ***
- STDMETHOD_(UINT,CopyCallback) (THIS_ HWND hwnd, UINT wFunc, UINT wFlags, LPCSTR pszSrcFile, DWORD dwSrcAttribs,
- LPCSTR pszDestFile, DWORD dwDestAttribs) PURE;
- };
- typedef ICopyHookA * LPCOPYHOOKA;
- #undef INTERFACE
- #define INTERFACE ICopyHookW
- DECLARE_INTERFACE_(ICopyHookW, IUnknown) // sl
- {
- // *** IUnknown methods ***
- STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
- STDMETHOD_(ULONG,AddRef) (THIS) PURE;
- STDMETHOD_(ULONG,Release) (THIS) PURE;
- // *** ICopyHook methods ***
- STDMETHOD_(UINT,CopyCallback) (THIS_ HWND hwnd, UINT wFunc, UINT wFlags, LPCWSTR pszSrcFile, DWORD dwSrcAttribs,
- LPCWSTR pszDestFile, DWORD dwDestAttribs) PURE;
- };
- typedef ICopyHookW * LPCOPYHOOKW;
- #ifdef UNICODE
- #define ICopyHook ICopyHookW
- #define ICopyHookVtbl ICopyHookWVtbl
- #define LPCOPYHOOK LPCOPYHOOKW
- #else
- #define ICopyHook ICopyHookA
- #define ICopyHookVtbl ICopyHookAVtbl
- #define LPCOPYHOOK LPCOPYHOOKA
- #endif
- //===========================================================================
- //
- // IFileViewerSite Interface
- //
- //===========================================================================
- #undef INTERFACE
- #define INTERFACE IFileViewerSite
- DECLARE_INTERFACE_(IFileViewerSite, IUnknown)
- {
- // *** IUnknown methods ***
- STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
- STDMETHOD_(ULONG,AddRef) (THIS) PURE;
- STDMETHOD_(ULONG,Release) (THIS) PURE;
- // *** IFileViewerSite methods ***
- STDMETHOD(SetPinnedWindow) (THIS_ HWND hwnd) PURE;
- STDMETHOD(GetPinnedWindow) (THIS_ HWND *phwnd) PURE;
- };
- typedef IFileViewerSite * LPFILEVIEWERSITE;
- //===========================================================================
- //
- // IFileViewer Interface
- //
- // Implemented in a FileViewer component object. Used to tell a
- // FileViewer to PrintTo or to view, the latter happening though
- // ShowInitialize and Show. The filename is always given to the
- // viewer through IPersistFile.
- //
- //===========================================================================
- #include <pshpack8.h>
- typedef struct
- {
- // Stuff passed into viewer (in)
- DWORD cbSize; // Size of structure for future expansion...
- HWND hwndOwner; // who is the owner window.
- int iShow; // The show command
- // Passed in and updated (in/Out)
- DWORD dwFlags; // flags
- RECT rect; // Where to create the window may have defaults
- IUnknown *punkRel; // Relese this interface when window is visible
- // Stuff that might be returned from viewer (out)
- OLECHAR strNewFile[MAX_PATH]; // New File to view.
- } FVSHOWINFO, *LPFVSHOWINFO;
- #include <poppack.h> /* Return to byte packing */
- // Define File View Show Info Flags.
- #define FVSIF_RECT 0x00000001 // The rect variable has valid data.
- #define FVSIF_PINNED 0x00000002 // We should Initialize pinned
- #define FVSIF_NEWFAILED 0x08000000 // The new file passed back failed
- // to be viewed.
- #define FVSIF_NEWFILE 0x80000000 // A new file to view has been returned
- #define FVSIF_CANVIEWIT 0x40000000 // The viewer can view it.
- #undef INTERFACE
- #define INTERFACE IFileViewerA
- DECLARE_INTERFACE(IFileViewerA)
- {
- // *** IUnknown methods ***
- STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
- STDMETHOD_(ULONG,AddRef) (THIS) PURE;
- STDMETHOD_(ULONG,Release) (THIS) PURE;
- // *** IFileViewer methods ***
- STDMETHOD(ShowInitialize) (THIS_ LPFILEVIEWERSITE lpfsi) PURE;
- STDMETHOD(Show) (THIS_ LPFVSHOWINFO pvsi) PURE;
- STDMETHOD(PrintTo) (THIS_ LPSTR pszDriver, BOOL fSuppressUI) PURE;
- };
- typedef IFileViewerA * LPFILEVIEWERA;
- #undef INTERFACE
- #define INTERFACE IFileViewerW
- DECLARE_INTERFACE(IFileViewerW)
- {
- // *** IUnknown methods ***
- STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
- STDMETHOD_(ULONG,AddRef) (THIS) PURE;
- STDMETHOD_(ULONG,Release) (THIS) PURE;
- // *** IFileViewer methods ***
- STDMETHOD(ShowInitialize) (THIS_ LPFILEVIEWERSITE lpfsi) PURE;
- STDMETHOD(Show) (THIS_ LPFVSHOWINFO pvsi) PURE;
- STDMETHOD(PrintTo) (THIS_ LPWSTR pszDriver, BOOL fSuppressUI) PURE;
- };
- typedef IFileViewerW * LPFILEVIEWERW;
- #ifdef UNICODE
- #define IFileViewer IFileViewerW
- #define LPFILEVIEWER LPFILEVIEWERW
- #else
- #define IFileViewer IFileViewerA
- #define LPFILEVIEWER LPFILEVIEWERA
- #endif
- //==========================================================================
- //
- // IShellBrowser/IShellView/IShellFolder interface
- //
- // These three interfaces are used when the shell communicates with
- // name space extensions. The shell (explorer) provides IShellBrowser
- // interface, and extensions implements IShellFolder and IShellView
- // interfaces.
- //
- //==========================================================================
- //--------------------------------------------------------------------------
- //
- // Command/menuitem IDs
- //
- // The explorer dispatches WM_COMMAND messages based on the range of
- // command/menuitem IDs. All the IDs of menuitems that the view (right
- // pane) inserts must be in FCIDM_SHVIEWFIRST/LAST (otherwise, the explorer
- // won't dispatch them). The view should not deal with any menuitems
- // in FCIDM_BROWSERFIRST/LAST (otherwise, it won't work with the future
- // version of the shell).
- //
- // FCIDM_SHVIEWFIRST/LAST for the right pane (IShellView)
- // FCIDM_BROWSERFIRST/LAST for the explorer frame (IShellBrowser)
- // FCIDM_GLOBAL/LAST for the explorer's submenu IDs
- //
- //--------------------------------------------------------------------------
- #define FCIDM_SHVIEWFIRST 0x0000
- #define FCIDM_SHVIEWLAST 0x7fff
- #define FCIDM_BROWSERFIRST 0xa000
- #define FCIDM_BROWSERLAST 0xbf00
- #define FCIDM_GLOBALFIRST 0x8000
- #define FCIDM_GLOBALLAST 0x9fff
- //
- // Global submenu IDs and separator IDs
- //
- #define FCIDM_MENU_FILE (FCIDM_GLOBALFIRST+0x0000)
- #define FCIDM_MENU_EDIT (FCIDM_GLOBALFIRST+0x0040)
- #define FCIDM_MENU_VIEW (FCIDM_GLOBALFIRST+0x0080)
- #define FCIDM_MENU_VIEW_SEP_OPTIONS (FCIDM_GLOBALFIRST+0x0081)
- #define FCIDM_MENU_TOOLS (FCIDM_GLOBALFIRST+0x00c0) // for Win9x compat
- #define FCIDM_MENU_TOOLS_SEP_GOTO (FCIDM_GLOBALFIRST+0x00c1) // for Win9x compat
- #define FCIDM_MENU_HELP (FCIDM_GLOBALFIRST+0x0100)
- #define FCIDM_MENU_FIND (FCIDM_GLOBALFIRST+0x0140)
- #define FCIDM_MENU_EXPLORE (FCIDM_GLOBALFIRST+0x0150)
- #define FCIDM_MENU_FAVORITES (FCIDM_GLOBALFIRST+0x0170)
- //--------------------------------------------------------------------------
- // control IDs known to the view
- //--------------------------------------------------------------------------
- #define FCIDM_TOOLBAR (FCIDM_BROWSERFIRST + 0)
- #define FCIDM_STATUS (FCIDM_BROWSERFIRST + 1)
- #if (_WIN32_IE >= 0x0400)
- //--------------------------------------------------------------------------
- //
- // The resource id of the offline cursor
- // This cursor is avaialble in shdocvw.dll
- #define IDC_OFFLINE_HAND 103
- //
- //--------------------------------------------------------------------------
- #endif
- //-------------------------------------------------------------------------
- // ICommDlgBrowser interface
- //
- // ICommDlgBrowser interface is the interface that is provided by the new
- // common dialog window to hook and modify the behavior of IShellView. When
- // a default view is created, it queries its parent IShellBrowser for the
- // ICommDlgBrowser interface. If supported, it calls out to that interface
- // in several cases that need to behave differently in a dialog.
- //
- // Member functions:
- //
- // ICommDlgBrowser::OnDefaultCommand()
- // Called when the user double-clicks in the view or presses Enter. The
- // browser should return S_OK if it processed the action itself, S_FALSE
- // to let the view perform the default action.
- //
- // ICommDlgBrowser::OnStateChange(ULONG uChange)
- // Called when some states in the view change. 'uChange' is one of the
- // CDBOSC_* values. This call is made after the state (selection, focus,
- // etc) has changed. There is no return value.
- //
- // ICommDlgBrowser::IncludeObject(LPCITEMIDLIST pidl)
- // Called when the view is enumerating objects. 'pidl' is a relative
- // IDLIST. The browser should return S_OK to include the object in the
- // view, S_FALSE to hide it
- //
- //-------------------------------------------------------------------------
- #define CDBOSC_SETFOCUS 0x00000000
- #define CDBOSC_KILLFOCUS 0x00000001
- #define CDBOSC_SELCHANGE 0x00000002
- #define CDBOSC_RENAME 0x00000003
- #define CDBOSC_STATECHANGE 0x00000004
- #undef INTERFACE
- #define INTERFACE ICommDlgBrowser
- DECLARE_INTERFACE_(ICommDlgBrowser, IUnknown)
- {
- // *** IUnknown methods ***
- STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
- STDMETHOD_(ULONG,AddRef) (THIS) PURE;
- STDMETHOD_(ULONG,Release) (THIS) PURE;
- // *** ICommDlgBrowser methods ***
- STDMETHOD(OnDefaultCommand) (THIS_ struct IShellView * ppshv) PURE;
- STDMETHOD(OnStateChange) (THIS_ struct IShellView * ppshv,
- ULONG uChange) PURE;
- STDMETHOD(IncludeObject) (THIS_ struct IShellView * ppshv,
- LPCITEMIDLIST pidl) PURE;
- };
- typedef ICommDlgBrowser * LPCOMMDLGBROWSER;
- //-------------------------------------------------------------------------
- // ICommDlgBrowser2 interface
- //
- // Member functions:
- //
- // ICommDlgBrowser2::Notify(IShellView *pshv, DWORD dwNotfyType)
- // Called when the view is wants to notify common dialog when an event
- // occurrs.
- //
- // CDB2N_CONTEXTMENU_START indicates the context menu has started.
- // CDB2N_CONTEXTMENU_DONE indicates the context menu has completed.
- //
- // ICommDlgBrowser2::GetDefaultMenuText(IShellView *pshv,
- // WCHAR *pszText, INT cchMax)
- // Called when the view wants to get the default context menu text.
- // pszText points to buffer and cchMax specifies the size of the
- // buffer in characters. The browser on return has filled the buffer
- // with the default context menu text. The Shell will call this method
- // with at least a buffer size of MAX_PATH. The browser should return
- // S_OK if it returned a new default menu text, S_FALSE to let the view
- // to use the normal default menu text.
- //
- // ICommDlgBrowser2::GetViewFlags(DWORD *pdwFlags)
- // Called when the view wants to determine if special customization needs to
- // be done for the common dialog browser. For example View calls this function to
- // determin if all files(hidden and system)needs to be shown. If the GetViewFlags returns a DWORD with
- // CDB2GVF_SHOWALLFILES flag set then it will show all the files.
- //-------------------------------------------------------------------------
- #define CDB2N_CONTEXTMENU_DONE 0x00000001
- #define CDB2N_CONTEXTMENU_START 0x00000002
- //GetViewFlags
- #define CDB2GVF_SHOWALLFILES 0x00000001
- #undef INTERFACE
- #define INTERFACE ICommDlgBrowser2
- DECLARE_INTERFACE_(ICommDlgBrowser2, IUnknown)
- {
- // *** IUnknown methods ***
- STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
- STDMETHOD_(ULONG,AddRef) (THIS) PURE;
- STDMETHOD_(ULONG,Release) (THIS) PURE;
- // *** ICommDlgBrowser methods ***
- STDMETHOD(OnDefaultCommand) (THIS_ struct IShellView * ppshv) PURE;
- STDMETHOD(OnStateChange) (THIS_ struct IShellView * ppshv,
- ULONG uChange) PURE;
- STDMETHOD(IncludeObject) (THIS_ struct IShellView * ppshv,
- LPCITEMIDLIST pidl) PURE;
- // *** ICommDlgBrowser2 methods ***
- STDMETHOD(Notify) (THIS_ struct IShellView * ppshv,
- DWORD dwNotifyType) PURE;
- STDMETHOD(GetDefaultMenuText) (THIS_ struct IShellView * ppshv,
- WCHAR *pszText, INT cchMax) PURE;
- STDMETHOD(GetViewFlags)(THIS_ DWORD *pdwFlags) PURE;
- };
- typedef ICommDlgBrowser2 * LPCOMMDLGBROWSER2;
- //
- // function assumes the size of the buffer (MAX_PATH). The pidl
- // should point to a file system object.
- SHSTDAPI_(BOOL) SHGetPathFromIDListA(LPCITEMIDLIST pidl, LPSTR pszPath);
- SHSTDAPI_(BOOL) SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath);
- #ifdef UNICODE
- #define SHGetPathFromIDList SHGetPathFromIDListW
- #else
- #define SHGetPathFromIDList SHGetPathFromIDListA
- #endif // !UNICODE
- SHSTDAPI_(int) SHCreateDirectoryExA(HWND hwnd, LPCSTR pszPath, SECURITY_ATTRIBUTES *psa);
- SHSTDAPI_(int) SHCreateDirectoryExW(HWND hwnd, LPCWSTR pszPath, SECURITY_ATTRIBUTES *psa);
- #ifdef UNICODE
- #define SHCreateDirectoryEx SHCreateDirectoryExW
- #else
- #define SHCreateDirectoryEx SHCreateDirectoryExA
- #endif // !UNICODE
- SHSTDAPI SHOpenFolderAndSelectItems(LPCITEMIDLIST pidlFolder, UINT cidl, LPCITEMIDLIST *apidl, DWORD dwFlags);
- //-------------------------------------------------------------------------
- //
- // SHGetSpecialFolderLocation
- //
- // Caller should use SHGetMalloc to obtain an allocator that can free the pidl
- //
- //
- //-------------------------------------------------------------------------
- //
- // registry entries for special paths are kept in :
- #define REGSTR_PATH_SPECIAL_FOLDERS REGSTR_PATH_EXPLORER TEXT("\Shell Folders")
- #define CSIDL_DESKTOP 0x0000 // <desktop>
- #define CSIDL_INTERNET 0x0001 // Internet Explorer (icon on desktop)
- #define CSIDL_PROGRAMS 0x0002 // Start MenuPrograms
- #define CSIDL_CONTROLS 0x0003 // My ComputerControl Panel
- #define CSIDL_PRINTERS 0x0004 // My ComputerPrinters
- #define CSIDL_PERSONAL 0x0005 // My Documents
- #define CSIDL_FAVORITES 0x0006 // <user name>Favorites
- #define CSIDL_STARTUP 0x0007 // Start MenuProgramsStartup
- #define CSIDL_RECENT 0x0008 // <user name>Recent
- #define CSIDL_SENDTO 0x0009 // <user name>SendTo
- #define CSIDL_BITBUCKET 0x000a // <desktop>Recycle Bin
- #define CSIDL_STARTMENU 0x000b // <user name>Start Menu
- #define CSIDL_MYDOCUMENTS 0x000c // logical "My Documents" desktop icon
- #define CSIDL_MYMUSIC 0x000d // "My Music" folder
- #define CSIDL_MYVIDEO 0x000e // "My Videos" folder
- #define CSIDL_DESKTOPDIRECTORY 0x0010 // <user name>Desktop
- #define CSIDL_DRIVES 0x0011 // My Computer
- #define CSIDL_NETWORK 0x0012 // Network Neighborhood (My Network Places)
- #define CSIDL_NETHOOD 0x0013 // <user name>nethood
- #define CSIDL_FONTS 0x0014 // windowsfonts
- #define CSIDL_TEMPLATES 0x0015
- #define CSIDL_COMMON_STARTMENU 0x0016 // All UsersStart Menu
- #define CSIDL_COMMON_PROGRAMS 0X0017 // All UsersStart MenuPrograms
- #define CSIDL_COMMON_STARTUP 0x0018 // All UsersStartup
- #define CSIDL_COMMON_DESKTOPDIRECTORY 0x0019 // All UsersDesktop
- #define CSIDL_APPDATA 0x001a // <user name>Application Data
- #define CSIDL_PRINTHOOD 0x001b // <user name>PrintHood
- #ifndef CSIDL_LOCAL_APPDATA
- #define CSIDL_LOCAL_APPDATA 0x001c // <user name>Local SettingsApplicaiton Data (non roaming)
- #endif // CSIDL_LOCAL_APPDATA
- #define CSIDL_ALTSTARTUP 0x001d // non localized startup
- #define CSIDL_COMMON_ALTSTARTUP 0x001e // non localized common startup
- #define CSIDL_COMMON_FAVORITES 0x001f
- #ifndef _SHFOLDER_H_
- #define CSIDL_INTERNET_CACHE 0x0020
- #define CSIDL_COOKIES 0x0021
- #define CSIDL_HISTORY 0x0022
- #define CSIDL_COMMON_APPDATA 0x0023 // All UsersApplication Data
- #define CSIDL_WINDOWS 0x0024 // GetWindowsDirectory()
- #define CSIDL_SYSTEM 0x0025 // GetSystemDirectory()
- #define CSIDL_PROGRAM_FILES 0x0026 // C:Program Files
- #define CSIDL_MYPICTURES 0x0027 // C:Program FilesMy Pictures
- #endif // _SHFOLDER_H_
- #define CSIDL_PROFILE 0x0028 // USERPROFILE
- #define CSIDL_SYSTEMX86 0x0029 // x86 system directory on RISC
- #define CSIDL_PROGRAM_FILESX86 0x002a // x86 C:Program Files on RISC
- #ifndef _SHFOLDER_H_
- #define CSIDL_PROGRAM_FILES_COMMON 0x002b // C:Program FilesCommon
- #endif // _SHFOLDER_H_
- #define CSIDL_PROGRAM_FILES_COMMONX86 0x002c // x86 Program FilesCommon on RISC
- #define CSIDL_COMMON_TEMPLATES 0x002d // All UsersTemplates
- #ifndef _SHFOLDER_H_
- #define CSIDL_COMMON_DOCUMENTS 0x002e // All UsersDocuments
- #define CSIDL_COMMON_ADMINTOOLS 0x002f // All UsersStart MenuProgramsAdministrative Tools
- #define CSIDL_ADMINTOOLS 0x0030 // <user name>Start MenuProgramsAdministrative Tools
- #endif // _SHFOLDER_H_
- #define CSIDL_CONNECTIONS 0x0031 // Network and Dial-up Connections
- #define CSIDL_COMMON_MUSIC 0x0035 // All UsersMy Music
- #define CSIDL_COMMON_PICTURES 0x0036 // All UsersMy Pictures
- #define CSIDL_COMMON_VIDEO 0x0037 // All UsersMy Video
- #define CSIDL_RESOURCES 0x0038 // Resource Direcotry
- #ifndef _SHFOLDER_H_
- #define CSIDL_RESOURCES_LOCALIZED 0x0039 // Localized Resource Direcotry
- #endif // _SHFOLDER_H_
- #define CSIDL_COMMON_OEM_LINKS 0x003a // Links to All Users OEM specific apps
- #define CSIDL_CDBURN_AREA 0x003b // USERPROFILELocal SettingsApplication DataMicrosoftCD Burning
- // unused 0x003c
- #define CSIDL_COMPUTERSNEARME 0x003d // Computers Near Me (computered from Workgroup membership)
- #ifndef _SHFOLDER_H_
- #define CSIDL_FLAG_CREATE 0x8000 // combine with CSIDL_ value to force folder creation in SHGetFolderPath()
- #endif // _SHFOLDER_H_
- #define CSIDL_FLAG_DONT_VERIFY 0x4000 // combine with CSIDL_ value to return an unverified folder path
- #define CSIDL_FLAG_NO_ALIAS 0x1000 // combine with CSIDL_ value to insure non-alias versions of the pidl
- #define CSIDL_FLAG_PER_USER_INIT 0x0800 // combine with CSIDL_ value to indicate per-user init (eg. upgrade)
- #define CSIDL_FLAG_MASK 0xFF00 // mask for all possible flag values
- SHSTDAPI SHGetSpecialFolderLocation(HWND hwnd, int csidl, LPITEMIDLIST *ppidl);
- #if (_WIN32_IE >= 0x0400)
- SHSTDAPI_(BOOL) SHGetSpecialFolderPathA(HWND hwnd, LPSTR pszPath, int csidl, BOOL fCreate);
- SHSTDAPI_(BOOL) SHGetSpecialFolderPathW(HWND hwnd, LPWSTR pszPath, int csidl, BOOL fCreate);
- #ifdef UNICODE
- #define SHGetSpecialFolderPath SHGetSpecialFolderPathW
- #else
- #define SHGetSpecialFolderPath SHGetSpecialFolderPathA
- #endif // !UNICODE
- #if (_WIN32_IE >= 0x0500)
- typedef enum {
- SHGFP_TYPE_CURRENT = 0, // current value for user, verify it exists
- SHGFP_TYPE_DEFAULT = 1, // default value, may not exist
- } SHGFP_TYPE;