home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / Compilers / digital marsC compier / dm / include / win32 / Shlobj.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-08-08  |  92.5 KB  |  2,509 lines

  1. //===========================================================================
  2. //
  3. // Copyright (c) Microsoft Corporation 1991-1996
  4. //
  5. // File: shlobj.h
  6. //
  7. //===========================================================================
  8.  
  9. #ifndef _SHLOBJ_H_
  10. #define _SHLOBJ_H_
  11.  
  12. //
  13. // Define API decoration for direct importing of DLL references.
  14. //
  15. #ifndef WINSHELLAPI
  16. #if !defined(_SHELL32_)
  17. #define WINSHELLAPI DECLSPEC_IMPORT
  18. #else
  19. #define WINSHELLAPI
  20. #endif
  21. #endif // WINSHELLAPI
  22.  
  23.  
  24. #include <ole2.h>
  25. #ifndef _PRSHT_H_
  26. #include <prsht.h>
  27. #endif
  28. #ifndef _INC_COMMCTRL
  29. #include <commctrl.h>   // for LPTBBUTTON
  30. #endif
  31.  
  32. #ifndef INITGUID
  33. #include <shlguid.h>
  34. #endif /* !INITGUID */
  35.  
  36. #ifndef RC_INVOKED
  37. #pragma pack(1)         /* Assume byte packing throughout */
  38. #endif /* !RC_INVOKED */
  39.  
  40. #ifdef __cplusplus
  41. extern "C" {            /* Assume C declarations for C++ */
  42. #endif /* __cplusplus */
  43.  
  44. //===========================================================================
  45. //
  46. // Object identifiers in the explorer's name space (ItemID and IDList)
  47. //
  48. //  All the items that the user can browse with the explorer (such as files,
  49. // directories, servers, work-groups, etc.) has an identifier which is unique
  50. // among items within the parent folder. Those identifiers are called item
  51. // IDs (SHITEMID). Since all its parent folders have their own item IDs,
  52. // any items can be uniquely identified by a list of item IDs, which is called
  53. // an ID list (ITEMIDLIST).
  54. //
  55. //  ID lists are almost always allocated by the task allocator (see some
  56. // description below as well as OLE 2.0 SDK) and may be passed across
  57. // some of shell interfaces (such as IShellFolder). Each item ID in an ID list
  58. // is only meaningful to its parent folder (which has generated it), and all
  59. // the clients must treat it as an opaque binary data except the first two
  60. // bytes, which indicates the size of the item ID.
  61. //
  62. //  When a shell extension -- which implements the IShellFolder interace --
  63. // generates an item ID, it may put any information in it, not only the data
  64. // with that it needs to identifies the item, but also some additional
  65. // information, which would help implementing some other functions efficiently.
  66. // For example, the shell's IShellFolder implementation of file system items
  67. // stores the primary (long) name of a file or a directory as the item
  68. // identifier, but it also stores its alternative (short) name, size and date
  69. // etc.
  70. //
  71. //  When an ID list is passed to one of shell APIs (such as SHGetPathFromIDList),
  72. // it is always an absolute path -- relative from the root of the name space,
  73. // which is the desktop folder. When an ID list is passed to one of IShellFolder
  74. // member function, it is always a relative path from the folder (unless it
  75. // is explicitly specified).
  76. //
  77. //===========================================================================
  78.  
  79. //
  80. // SHITEMID -- Item ID
  81. //
  82. typedef struct _SHITEMID        // mkid
  83. {
  84.     USHORT      cb;             // Size of the ID (including cb itself)
  85.     BYTE        abID[1];        // The item ID (variable length)
  86. } SHITEMID;
  87. typedef UNALIGNED SHITEMID *LPSHITEMID;
  88. typedef const UNALIGNED SHITEMID *LPCSHITEMID;
  89.  
  90. //
  91. // ITEMIDLIST -- List if item IDs (combined with 0-terminator)
  92. //
  93. typedef struct _ITEMIDLIST      // idl
  94. {
  95.     SHITEMID    mkid;
  96. } ITEMIDLIST;
  97. typedef UNALIGNED ITEMIDLIST * LPITEMIDLIST;
  98. typedef const UNALIGNED ITEMIDLIST * LPCITEMIDLIST;
  99.  
  100.  
  101. //===========================================================================
  102. //
  103. // Task allocator API
  104. //
  105. //  All the shell extensions MUST use the task allocator (see OLE 2.0
  106. // programming guild for its definition) when they allocate or free
  107. // memory objects (mostly ITEMIDLIST) that are returned across any
  108. // shell interfaces. There are two ways to access the task allocator
  109. // from a shell extension depending on whether or not it is linked with
  110. // OLE32.DLL or not (purely for efficiency).
  111. //
  112. // (1) A shell extension which calls any OLE API (i.e., linked with
  113. //  OLE32.DLL) should call OLE's task allocator (by retrieving
  114. //  the task allocator by calling CoGetMalloc API).
  115. //
  116. // (2) A shell extension which does not call any OLE API (i.e., not linked
  117. //  with OLE32.DLL) should call the shell task allocator API (defined
  118. //  below), so that the shell can quickly loads it when OLE32.DLL is not
  119. //  loaded by any application at that point.
  120. //
  121. // Notes:
  122. //  In next version of Windowso release, SHGetMalloc will be replaced by
  123. // the following macro.
  124. //
  125. // #define SHGetMalloc(ppmem)   CoGetMalloc(MEMCTX_TASK, ppmem)
  126. //
  127. //===========================================================================
  128.  
  129. WINSHELLAPI HRESULT WINAPI SHGetMalloc(LPMALLOC * ppMalloc);
  130.  
  131.  
  132.  
  133. //===========================================================================
  134. //
  135. // IContextMenu interface
  136. //
  137. // [OverView]
  138. //
  139. //  The shell uses the IContextMenu interface in following three cases.
  140. //
  141. // case-1: The shell is loading context menu extensions.
  142. //
  143. //   When the user clicks the right mouse button on an item within the shell's
  144. //  name space (i.g., file, directory, server, work-group, etc.), it creates
  145. //  the default context menu for its type, then loads context menu extensions
  146. //  that are registered for that type (and its base type) so that they can
  147. //  add extra menu items. Those context menu extensions are registered at
  148. //  HKCR\{ProgID}\shellex\ContextMenuHandlers.
  149. //
  150. // case-2: The shell is retrieving a context menu of sub-folders in extended
  151. //   name-space.
  152. //
  153. //   When the explorer's name space is extended by name space extensions,
  154. //  the shell calls their IShellFolder::GetUIObjectOf to get the IContextMenu
  155. //  objects when it creates context menus for folders under those extended
  156. //  name spaces.
  157. //
  158. // case-3: The shell is loading non-default drag and drop handler for directories.
  159. //
  160. //   When the user performed a non-default drag and drop onto one of file
  161. //  system folders (i.e., directories), it loads shell extensions that are
  162. //  registered at HKCR\{ProgID}\DragDropHandlers.
  163. //
  164. //
  165. // [Member functions]
  166. //
  167. //
  168. // IContextMenu::QueryContextMenu
  169. //
  170. //   This member function may insert one or more menuitems to the specified
  171. //  menu (hmenu) at the specified location (indexMenu which is never be -1).
  172. //  The IDs of those menuitem must be in the specified range (idCmdFirst and
  173. //  idCmdLast). It returns the maximum menuitem ID offset (ushort) in the
  174. //  'code' field (low word) of the scode.
  175. //
  176. //   The uFlags specify the context. It may have one or more of following
  177. //  flags.
  178. //
  179. //  CMF_DEFAULTONLY: This flag is passed if the user is invoking the default
  180. //   action (typically by double-clicking, case 1 and 2 only). Context menu
  181. //   extensions (case 1) should not add any menu items, and returns NOERROR.
  182. //
  183. //  CMF_VERBSONLY: The explorer passes this flag if it is constructing
  184. //   a context menu for a short-cut object (case 1 and case 2 only). If this
  185. //   flag is passed, it should not add any menu-items that is not appropriate
  186. //   from a short-cut.
  187. //    A good example is the "Delete" menuitem, which confuses the user
  188. //   because it is not clear whether it deletes the link source item or the
  189. //   link itself.
  190. //
  191. //  CMF_EXPLORER: The explorer passes this flag if it has the left-side pane
  192. //   (case 1 and 2 only). Context menu extensions should ignore this flag.
  193. //
  194. //   High word (16-bit) are reserved for context specific communications
  195. //  and the rest of flags (13-bit) are reserved by the system.
  196. //
  197. //
  198. // IContextMenu::InvokeCommand
  199. //
  200. //   This member is called when the user has selected one of menuitems that
  201. //  are inserted by previous QueryContextMenu member. In this case, the
  202. //  LOWORD(lpici->lpVerb) contains the menuitem ID offset (menuitem ID -
  203. //  idCmdFirst).
  204. //
  205. //   This member function may also be called programmatically. In such a case,
  206. //  lpici->lpVerb specifies the canonical name of the command to be invoked,
  207. //  which is typically retrieved by GetCommandString member previously.
  208. //
  209. //  Parameters in lpci:
  210. //    cbSize -- Specifies the size of this structure (sizeof(*lpci))
  211. //    hwnd   -- Specifies the owner window for any message/dialog box.
  212. //    fMask  -- Specifies whether or not dwHotkey/hIcon paramter is valid.
  213. //    lpVerb -- Specifies the command to be invoked.
  214. //    lpParameters -- Parameters (optional)
  215. //    lpDirectory  -- Working directory (optional)
  216. //    nShow -- Specifies the flag to be passed to ShowWindow (SW_*).
  217. //    dwHotKey -- Hot key to be assigned to the app after invoked (optional).
  218. //    hIcon -- Specifies the icon (optional).
  219. //
  220. //
  221. // IContextMenu::GetCommandString
  222. //
  223. //   This member function is called by the explorer either to get the
  224. //  canonical (language independent) command name (uFlags == GCS_VERB) or
  225. //  the help text ((uFlags & GCS_HELPTEXT) != 0) for the specified command.
  226. //  The retrieved canonical string may be passed to its InvokeCommand
  227. //  member function to invoke a command programmatically. The explorer
  228. //  displays the help texts in its status bar; therefore, the length of
  229. //  the help text should be reasonably short (<40 characters).
  230. //
  231. //  Parameters:
  232. //   idCmd -- Specifies menuitem ID offset (from idCmdFirst)
  233. //   uFlags -- Either GCS_VERB or GCS_HELPTEXT
  234. //   pwReserved -- Reserved (must pass NULL when calling, must ignore when called)
  235. //   pszName -- Specifies the string buffer.
  236. //   cchMax -- Specifies the size of the string buffer.
  237. //
  238. //===========================================================================
  239.  
  240. // QueryContextMenu uFlags
  241. #define CMF_NORMAL              0x00000000
  242. #define CMF_DEFAULTONLY         0x00000001
  243. #define CMF_VERBSONLY           0x00000002
  244. #define CMF_EXPLORE             0x00000004
  245. #define CMF_NOVERBS             0x00000008
  246. #define CMF_CANRENAME           0x00000010
  247. #define CMF_NODEFAULT           0x00000020
  248. #define CMF_INCLUDESTATIC       0x00000040
  249. #define CMF_RESERVED            0xffff0000      // View specific
  250.  
  251. // GetCommandString uFlags
  252. #define GCS_VERBA        0x00000000     // canonical verb
  253. #define GCS_HELPTEXTA    0x00000001     // help text (for status bar)
  254. #define GCS_VALIDATEA    0x00000002     // validate command exists
  255. #define GCS_VERBW        0x00000004     // canonical verb (unicode)
  256. #define GCS_HELPTEXTW    0x00000005     // help text (unicode version)
  257. #define GCS_VALIDATEW    0x00000006     // validate command exists (unicode)
  258. #define GCS_UNICODE      0x00000004     // for bit testing - Unicode string
  259.  
  260. #ifdef UNICODE
  261. #define GCS_VERB        GCS_VERBW
  262. #define GCS_HELPTEXT    GCS_HELPTEXTW
  263. #define GCS_VALIDATE    GCS_VALIDATEW
  264. #else
  265. #define GCS_VERB        GCS_VERBA
  266. #define GCS_HELPTEXT    GCS_HELPTEXTA
  267. #define GCS_VALIDATE    GCS_VALIDATEA
  268. #endif
  269.  
  270. #define CMDSTR_NEWFOLDERA   "NewFolder"
  271. #define CMDSTR_VIEWLISTA    "ViewList"
  272. #define CMDSTR_VIEWDETAILSA "ViewDetails"
  273. #define CMDSTR_NEWFOLDERW   L"NewFolder"
  274. #define CMDSTR_VIEWLISTW    L"ViewList"
  275. #define CMDSTR_VIEWDETAILSW L"ViewDetails"
  276.  
  277. #ifdef UNICODE
  278. #define CMDSTR_NEWFOLDER    CMDSTR_NEWFOLDERW
  279. #define CMDSTR_VIEWLIST     CMDSTR_VIEWLISTW
  280. #define CMDSTR_VIEWDETAILS  CMDSTR_VIEWDETAILSW
  281. #else
  282. #define CMDSTR_NEWFOLDER    CMDSTR_NEWFOLDERA
  283. #define CMDSTR_VIEWLIST     CMDSTR_VIEWLISTA
  284. #define CMDSTR_VIEWDETAILS  CMDSTR_VIEWDETAILSA
  285. #endif
  286.  
  287. #define CMIC_MASK_HOTKEY        SEE_MASK_HOTKEY
  288. #define CMIC_MASK_ICON          SEE_MASK_ICON
  289. #define CMIC_MASK_FLAG_NO_UI    SEE_MASK_FLAG_NO_UI
  290. #define CMIC_MASK_UNICODE       SEE_MASK_UNICODE
  291. #define CMIC_MASK_NO_CONSOLE    SEE_MASK_NO_CONSOLE
  292. #define CMIC_MASK_HASLINKNAME   SEE_MASK_HASLINKNAME
  293. #define CMIC_MASK_FLAG_SEP_VDM  SEE_MASK_FLAG_SEPVDM
  294. #define CMIC_MASK_HASTITLE      SEE_MASK_HASTITLE
  295. #define CMIC_MASK_ASYNCOK       SEE_MASK_ASYNCOK
  296.  
  297.  
  298. typedef struct _CMINVOKECOMMANDINFO {
  299.     DWORD cbSize;        // sizeof(CMINVOKECOMMANDINFO)
  300.     DWORD fMask;         // any combination of CMIC_MASK_*
  301.     HWND hwnd;           // might be NULL (indicating no owner window)
  302.     LPCSTR lpVerb;       // either a string or MAKEINTRESOURCE(idOffset)
  303.     LPCSTR lpParameters; // might be NULL (indicating no parameter)
  304.     LPCSTR lpDirectory;  // might be NULL (indicating no specific directory)
  305.     int nShow;           // one of SW_ values for ShowWindow() API
  306.  
  307.     DWORD dwHotKey;
  308.     HANDLE hIcon;
  309. } CMINVOKECOMMANDINFO,  *LPCMINVOKECOMMANDINFO;
  310.  
  311. typedef struct _CMInvokeCommandInfoEx {
  312.     DWORD cbSize;        // must be sizeof(CMINVOKECOMMANDINFOEX)
  313.     DWORD fMask;         // any combination of CMIC_MASK_*
  314.     HWND hwnd;           // might be NULL (indicating no owner window)
  315.     LPCSTR lpVerb;       // either a string or MAKEINTRESOURCE(idOffset)
  316.     LPCSTR lpParameters; // might be NULL (indicating no parameter)
  317.     LPCSTR lpDirectory;  // might be NULL (indicating no specific directory)
  318.     int nShow;           // one of SW_ values for ShowWindow() API
  319.  
  320.     DWORD dwHotKey;
  321.     HANDLE hIcon;
  322.     LPCSTR lpTitle;      // For CreateProcess-StartupInfo.lpTitle
  323.     LPCWSTR lpVerbW;        // Unicode verb (for those who can use it)
  324.     LPCWSTR lpParametersW;  // Unicode parameters (for those who can use it)
  325.     LPCWSTR lpDirectoryW;   // Unicode directory (for those who can use it)
  326.     LPCWSTR lpTitleW;       // Unicode title (for those who can use it)
  327. } CMINVOKECOMMANDINFOEX,  *LPCMINVOKECOMMANDINFOEX;
  328.  
  329. #undef  INTERFACE
  330. #define INTERFACE   IContextMenu
  331.  
  332. DECLARE_INTERFACE_(IContextMenu, IUnknown)
  333. {
  334.     // *** IUnknown methods ***
  335.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  336.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  337.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  338.  
  339.     STDMETHOD(QueryContextMenu)(THIS_
  340.                                 HMENU hmenu,
  341.                                 UINT indexMenu,
  342.                                 UINT idCmdFirst,
  343.                                 UINT idCmdLast,
  344.                                 UINT uFlags) PURE;
  345.  
  346.     STDMETHOD(InvokeCommand)(THIS_
  347.                              LPCMINVOKECOMMANDINFO lpici) PURE;
  348.  
  349.     STDMETHOD(GetCommandString)(THIS_
  350.                                 UINT        idCmd,
  351.                                 UINT        uType,
  352.                                 UINT      * pwReserved,
  353.                                 LPSTR       pszName,
  354.                                 UINT        cchMax) PURE;
  355. };
  356.  
  357. typedef IContextMenu *  LPCONTEXTMENU;
  358.  
  359. //
  360. // IContextMenu2 (IContextMenu with one new member)
  361. //
  362. // IContextMenu2::HandleMenuMsg
  363. //
  364. //  This function is called, if the client of IContextMenu is aware of
  365. // IContextMenu2 interface and receives one of following messages while
  366. // it is calling TrackPopupMenu (in the window proc of hwndOwner):
  367. //      WM_INITPOPUP, WM_DRAWITEM and WM_MEASUREITEM
  368. //  The callee may handle these messages to draw owner draw menuitems.
  369. //
  370.  
  371. #undef  INTERFACE
  372. #define INTERFACE   IContextMenu2
  373.  
  374. DECLARE_INTERFACE_(IContextMenu2, IUnknown)
  375. {
  376.     // *** IUnknown methods ***
  377.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  378.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  379.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  380.  
  381.     STDMETHOD(QueryContextMenu)(THIS_
  382.                                 HMENU hmenu,
  383.                                 UINT indexMenu,
  384.                                 UINT idCmdFirst,
  385.                                 UINT idCmdLast,
  386.                                 UINT uFlags) PURE;
  387.  
  388.     STDMETHOD(InvokeCommand)(THIS_
  389.                              LPCMINVOKECOMMANDINFO lpici) PURE;
  390.  
  391.     STDMETHOD(GetCommandString)(THIS_
  392.                                 UINT        idCmd,
  393.                                 UINT        uType,
  394.                                 UINT      * pwReserved,
  395.                                 LPSTR       pszName,
  396.                                 UINT        cchMax) PURE;
  397.     STDMETHOD(HandleMenuMsg)(THIS_
  398.                              UINT uMsg,
  399.                              WPARAM wParam,
  400.                              LPARAM lParam) PURE;
  401. };
  402.  
  403. typedef IContextMenu2 * LPCONTEXTMENU2;
  404.  
  405.  
  406.  
  407.  
  408. //===========================================================================
  409. //
  410. // Interface: IShellExtInit
  411. //
  412. //  The IShellExtInit interface is used by the explorer to initialize shell
  413. // extension objects. The explorer (1) calls CoCreateInstance (or equivalent)
  414. // with the registered CLSID and IID_IShellExtInit, (2) calls its Initialize
  415. // member, then (3) calls its QueryInterface to a particular interface (such
  416. // as IContextMenu or IPropSheetExt and (4) performs the rest of operation.
  417. //
  418. //
  419. // [Member functions]
  420. //
  421. // IShellExtInit::Initialize
  422. //
  423. //  This member function is called when the explorer is initializing either
  424. // context menu extension, property sheet extension or non-default drag-drop
  425. // extension.
  426. //
  427. //  Parameters: (context menu or property sheet extension)
  428. //   pidlFolder -- Specifies the parent folder
  429. //   lpdobj -- Spefifies the set of items selected in that folder.
  430. //   hkeyProgID -- Specifies the type of the focused item in the selection.
  431. //
  432. //  Parameters: (non-default drag-and-drop extension)
  433. //   pidlFolder -- Specifies the target (destination) folder
  434. //   lpdobj -- Specifies the items that are dropped (see the description
  435. //    about shell's clipboard below for clipboard formats).
  436. //   hkeyProgID -- Specifies the folder type.
  437. //
  438. //===========================================================================
  439.  
  440. #undef  INTERFACE
  441. #define INTERFACE   IShellExtInit
  442.  
  443. DECLARE_INTERFACE_(IShellExtInit, IUnknown)
  444. {
  445.     // *** IUnknown methods ***
  446.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  447.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  448.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  449.  
  450.     // *** IShellExtInit methods ***
  451.     STDMETHOD(Initialize)(THIS_ LPCITEMIDLIST pidlFolder,
  452.                           LPDATAOBJECT lpdobj, HKEY hkeyProgID) PURE;
  453. };
  454.  
  455. typedef IShellExtInit * LPSHELLEXTINIT;
  456.  
  457.  
  458. //===========================================================================
  459. //
  460. // Interface: IShellPropSheetExt
  461. //
  462. //  The explorer uses the IShellPropSheetExt to allow property sheet
  463. // extensions or control panel extensions to add additional property
  464. // sheet pages.
  465. //
  466. //
  467. // [Member functions]
  468. //
  469. // IShellPropSheetExt::AddPages
  470. //
  471. //  The explorer calls this member function when it finds a registered
  472. // property sheet extension for a particular type of object. For each
  473. // additional page, the extension creates a page object by calling
  474. // CreatePropertySheetPage API and calls lpfnAddPage.
  475. //
  476. //  Parameters:
  477. //   lpfnAddPage -- Specifies the callback function.
  478. //   lParam -- Specifies the opaque handle to be passed to the callback function.
  479. //
  480. //
  481. // IShellPropSheetExt::ReplacePage
  482. //
  483. //  The explorer never calls this member of property sheet extensions. The
  484. // explorer calls this member of control panel extensions, so that they
  485. // can replace some of default control panel pages (such as a page of
  486. // mouse control panel).
  487. //
  488. //  Parameters:
  489. //   uPageID -- Specifies the page to be replaced.
  490. //   lpfnReplace Specifies the callback function.
  491. //   lParam -- Specifies the opaque handle to be passed to the callback function.
  492. //
  493. //===========================================================================
  494.  
  495. #undef  INTERFACE
  496. #define INTERFACE   IShellPropSheetExt
  497.  
  498. DECLARE_INTERFACE_(IShellPropSheetExt, IUnknown)
  499. {
  500.     // *** IUnknown methods ***
  501.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  502.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  503.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  504.  
  505.     // *** IShellPropSheetExt methods ***
  506.     STDMETHOD(AddPages)(THIS_ LPFNADDPROPSHEETPAGE lpfnAddPage, LPARAM lParam) PURE;
  507.     STDMETHOD(ReplacePage)(THIS_ UINT uPageID, LPFNADDPROPSHEETPAGE lpfnReplaceWith, LPARAM lParam) PURE;
  508. };
  509.  
  510. typedef IShellPropSheetExt * LPSHELLPROPSHEETEXT;
  511.  
  512.  
  513. //===========================================================================
  514. //
  515. // IPersistFolder Interface
  516. //
  517. //  The IPersistFolder interface is used by the file system implementation of
  518. // IShellFolder::BindToObject when it is initializing a shell folder object.
  519. //
  520. //
  521. // [Member functions]
  522. //
  523. // IPersistFolder::Initialize
  524. //
  525. //  This member function is called when the explorer is initializing a
  526. // shell folder object.
  527. //
  528. //  Parameters:
  529. //   pidl -- Specifies the absolute location of the folder.
  530. //
  531. //===========================================================================
  532.  
  533. #undef  INTERFACE
  534. #define INTERFACE   IPersistFolder
  535.  
  536. DECLARE_INTERFACE_(IPersistFolder, IPersist)    // fld
  537. {
  538.     // *** IUnknown methods ***
  539.     STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  540.     STDMETHOD_(ULONG,AddRef)(THIS)  PURE;
  541.     STDMETHOD_(ULONG,Release)(THIS) PURE;
  542.  
  543.     // *** IPersist methods ***
  544.     STDMETHOD(GetClassID)(THIS_ LPCLSID lpClassID) PURE;
  545.  
  546.     // *** IPersistFolder methods ***
  547.     STDMETHOD(Initialize)(THIS_ LPCITEMIDLIST pidl) PURE;
  548. };
  549.  
  550. typedef IPersistFolder *LPPERSISTFOLDER;
  551.  
  552.  
  553. //===========================================================================
  554. //
  555. // IExtractIcon interface
  556. //
  557. //  This interface is used in two different places in the shell.
  558. //
  559. // Case-1: Icons of sub-folders for the scope-pane of the explorer.
  560. //
  561. //  It is used by the explorer to get the "icon location" of
  562. // sub-folders from each shell folders. When the user expands a folder
  563. // in the scope pane of the explorer, the explorer does following:
  564. //  (1) binds to the folder (gets IShellFolder),
  565. //  (2) enumerates its sub-folders by calling its EnumObjects member,
  566. //  (3) calls its GetUIObjectOf member to get IExtractIcon interface
  567. //     for each sub-folders.
  568. //  In this case, the explorer uses only IExtractIcon::GetIconLocation
  569. // member to get the location of the appropriate icon. An icon location
  570. // always consists of a file name (typically DLL or EXE) and either an icon
  571. // resource or an icon index.
  572. //
  573. //
  574. // Case-2: Extracting an icon image from a file
  575. //
  576. //  It is used by the shell when it extracts an icon image
  577. // from a file. When the shell is extracting an icon from a file,
  578. // it does following:
  579. //  (1) creates the icon extraction handler object (by getting its CLSID
  580. //     under the {ProgID}\shell\ExtractIconHanler key and calling
  581. //     CoCreateInstance requesting for IExtractIcon interface).
  582. //  (2) Calls IExtractIcon::GetIconLocation.
  583. //  (3) Then, calls IExtractIcon::ExtractIcon with the location/index pair.
  584. //  (4) If (3) returns NOERROR, it uses the returned icon.
  585. //  (5) Otherwise, it recursively calls this logic with new location
  586. //     assuming that the location string contains a fully qualified path name.
  587. //
  588. //  From extension programmer's point of view, there are only two cases
  589. // where they provide implementations of IExtractIcon:
  590. //  Case-1) providing explorer extensions (i.e., IShellFolder).
  591. //  Case-2) providing per-instance icons for some types of files.
  592. //
  593. // Because Case-1 is described above, we'll explain only Case-2 here.
  594. //
  595. // When the shell is about display an icon for a file, it does following:
  596. //  (1) Finds its ProgID and ClassID.
  597. //  (2) If the file has a ClassID, it gets the icon location string from the
  598. //    "DefaultIcon" key under it. The string indicates either per-class
  599. //    icon (e.g., "FOOBAR.DLL,2") or per-instance icon (e.g., "%1,1").
  600. //  (3) If a per-instance icon is specified, the shell creates an icon
  601. //    extraction handler object for it, and extracts the icon from it
  602. //    (which is described above).
  603. //
  604. //  It is important to note that the shell calls IExtractIcon::GetIconLocation
  605. // first, then calls IExtractIcon::Extract. Most application programs
  606. // that support per-instance icons will probably store an icon location
  607. // (DLL/EXE name and index/id) rather than an icon image in each file.
  608. // In those cases, a programmer needs to implement only the GetIconLocation
  609. // member and it Extract member simply returns S_FALSE. They need to
  610. // implement Extract member only if they decided to store the icon images
  611. // within files themselved or some other database (which is very rare).
  612. //
  613. //
  614. //
  615. // [Member functions]
  616. //
  617. //
  618. // IExtractIcon::GetIconLocation
  619. //
  620. //  This function returns an icon location.
  621. //
  622. //  Parameters:
  623. //   uFlags     [in]  -- Specifies if it is opened or not (GIL_OPENICON or 0)
  624. //   szIconFile [out] -- Specifies the string buffer buffer for a location name.
  625. //   cchMax     [in]  -- Specifies the size of szIconFile (almost always MAX_PATH)
  626. //   piIndex    [out] -- Sepcifies the address of UINT for the index.
  627. //   pwFlags    [out] -- Returns GIL_* flags
  628. //  Returns:
  629. //   NOERROR, if it returns a valid location; S_FALSE, if the shell use a
  630. //   default icon.
  631. //
  632. //  Notes: The location may or may not be a path to a file. The caller can
  633. //   not assume anything unless the subsequent Extract member call returns
  634. //   S_FALSE.
  635. //
  636. //   if the returned location is not a path to a file, GIL_NOTFILENAME should
  637. //   be set in the returned flags.
  638. //
  639. // IExtractIcon::Extract
  640. //
  641. //  This function extracts an icon image from a specified file.
  642. //
  643. //  Parameters:
  644. //   pszFile [in] -- Specifies the icon location (typically a path to a file).
  645. //   nIconIndex [in] -- Specifies the icon index.
  646. //   phiconLarge [out] -- Specifies the HICON variable for large icon.
  647. //   phiconSmall [out] -- Specifies the HICON variable for small icon.
  648. //   nIconSize [in] -- Specifies the size icon required (size of large icon)
  649. //                     LOWORD is the requested large icon size
  650. //                     HIWORD is the requested small icon size
  651. //  Returns:
  652. //   NOERROR, if it extracted the from the file.
  653. //   S_FALSE, if the caller should extract from the file specified in the
  654. //           location.
  655. //
  656. //===========================================================================
  657.  
  658. // GetIconLocation() input flags
  659.  
  660. #define GIL_OPENICON     0x0001      // allows containers to specify an "open" look
  661. #define GIL_FORSHELL     0x0002      // icon is to be displayed in a ShellFolder
  662. #define GIL_ASYNC        0x0020      // this is an async extract, return E_ASYNC
  663.  
  664. // GetIconLocation() return flags
  665.  
  666. #define GIL_SIMULATEDOC  0x0001      // simulate this document icon for this
  667. #define GIL_PERINSTANCE  0x0002      // icons from this class are per instance (each file has its own)
  668. #define GIL_PERCLASS     0x0004      // icons from this class per class (shared for all files of this type)
  669. #define GIL_NOTFILENAME  0x0008      // location is not a filename, must call ::ExtractIcon
  670. #define GIL_DONTCACHE    0x0010      // this icon should not be cached
  671.  
  672. #undef  INTERFACE
  673. #define INTERFACE   IExtractIconA
  674.  
  675. DECLARE_INTERFACE_(IExtractIconA, IUnknown)     // exic
  676. {
  677.     // *** IUnknown methods ***
  678.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  679.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  680.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  681.  
  682.     // *** IExtractIcon methods ***
  683.     STDMETHOD(GetIconLocation)(THIS_
  684.                          UINT   uFlags,
  685.                          LPSTR  szIconFile,
  686.                          UINT   cchMax,
  687.                          int   * piIndex,
  688.                          UINT  * pwFlags) PURE;
  689.  
  690.     STDMETHOD(Extract)(THIS_
  691.                            LPCSTR pszFile,
  692.                            UINT   nIconIndex,
  693.                            HICON   *phiconLarge,
  694.                            HICON   *phiconSmall,
  695.                            UINT    nIconSize) PURE;
  696. };
  697.  
  698. typedef IExtractIconA * LPEXTRACTICONA;
  699.  
  700. #undef  INTERFACE
  701. #define INTERFACE   IExtractIconW
  702.  
  703. DECLARE_INTERFACE_(IExtractIconW, IUnknown)     // exic
  704. {
  705.     // *** IUnknown methods ***
  706.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  707.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  708.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  709.  
  710.     // *** IExtractIcon methods ***
  711.     STDMETHOD(GetIconLocation)(THIS_
  712.                          UINT   uFlags,
  713.                          LPWSTR szIconFile,
  714.                          UINT   cchMax,
  715.                          int   * piIndex,
  716.                          UINT  * pwFlags) PURE;
  717.  
  718.     STDMETHOD(Extract)(THIS_
  719.                            LPCWSTR pszFile,
  720.                            UINT   nIconIndex,
  721.                            HICON   *phiconLarge,
  722.                            HICON   *phiconSmall,
  723.                            UINT    nIconSize) PURE;
  724. };
  725.  
  726. typedef IExtractIconW * LPEXTRACTICONW;
  727.  
  728. #ifdef UNICODE
  729. #define IExtractIcon        IExtractIconW
  730. #define IExtractIconVtbl    IExtractIconWVtbl
  731. #define LPEXTRACTICON       LPEXTRACTICONW
  732. #else
  733. #define IExtractIcon        IExtractIconA
  734. #define IExtractIconVtbl    IExtractIconAVtbl
  735. #define LPEXTRACTICON       LPEXTRACTICONA
  736. #endif
  737.  
  738. //===========================================================================
  739. //
  740. // IShellIcon Interface
  741. //
  742. // used to get a icon index for a IShellFolder object.
  743. //
  744. // this interface can be implemented by a IShellFolder, as a quick way to
  745. // return the icon for a object in the folder.
  746. //
  747. // a instance of this interface is only created once for the folder, unlike
  748. // IExtractIcon witch is created once for each object.
  749. //
  750. // if a ShellFolder does not implement this interface, the standard
  751. // GetUIObject(....IExtractIcon) method will be used to get a icon
  752. // for all objects.
  753. //
  754. // the following standard imagelist indexs can be returned:
  755. //
  756. //      0   document (blank page) (not associated)
  757. //      1   document (with stuff on the page)
  758. //      2   application (exe, com, bat)
  759. //      3   folder (plain)
  760. //      4   folder (open)
  761. //
  762. // IShellIcon:GetIconOf(pidl, flags, lpIconIndex)
  763. //
  764. //      pidl            object to get icon for.
  765. //      flags           GIL_* input flags (GIL_OPEN, ...)
  766. //      lpIconIndex     place to return icon index.
  767. //
  768. //  returns:
  769. //      NOERROR, if lpIconIndex contains the correct system imagelist index.
  770. //      S_FALSE, if unable to get icon for this object, go through
  771. //               GetUIObject, IExtractIcon, methods.
  772. //
  773. //===========================================================================
  774.  
  775. #undef  INTERFACE
  776. #define INTERFACE   IShellIcon
  777.  
  778. DECLARE_INTERFACE_(IShellIcon, IUnknown)      // shi
  779. {
  780.     // *** IUnknown methods ***
  781.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  782.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  783.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  784.  
  785.     // *** IShellIcon methods ***
  786.     STDMETHOD(GetIconOf)(THIS_ LPCITEMIDLIST pidl, UINT flags,
  787.                     LPINT lpIconIndex) PURE;
  788. };
  789.  
  790. typedef IShellIcon *LPSHELLICON;
  791.  
  792. //===========================================================================
  793. //
  794. // IShellLink Interface
  795. //
  796. //===========================================================================
  797.  
  798. #ifdef UNICODE
  799. #define IShellLink      IShellLinkW
  800. #define IShellLinkVtbl  IShellLinkWVtbl
  801. #else
  802. #define IShellLink      IShellLinkA
  803. #define IShellLinkVtbl  IShellLinkAVtbl
  804. #endif
  805.  
  806. // IShellLink::Resolve fFlags
  807. typedef enum {
  808.     SLR_NO_UI           = 0x0001,
  809.     SLR_ANY_MATCH       = 0x0002,
  810.     SLR_UPDATE          = 0x0004,
  811. } SLR_FLAGS;
  812.  
  813. // IShellLink::GetPath fFlags
  814. typedef enum {
  815.     SLGP_SHORTPATH      = 0x0001,
  816.     SLGP_UNCPRIORITY    = 0x0002,
  817. } SLGP_FLAGS;
  818.  
  819. #undef  INTERFACE
  820. #define INTERFACE   IShellLinkA
  821.  
  822. DECLARE_INTERFACE_(IShellLinkA, IUnknown)       // sl
  823. {
  824.     // *** IUnknown methods ***
  825.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  826.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  827.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  828.  
  829.     STDMETHOD(GetPath)(THIS_ LPSTR pszFile, int cchMaxPath, WIN32_FIND_DATAA *pfd, DWORD fFlags) PURE;
  830.  
  831.     STDMETHOD(GetIDList)(THIS_ LPITEMIDLIST * ppidl) PURE;
  832.     STDMETHOD(SetIDList)(THIS_ LPCITEMIDLIST pidl) PURE;
  833.  
  834.     STDMETHOD(GetDescription)(THIS_ LPSTR pszName, int cchMaxName) PURE;
  835.     STDMETHOD(SetDescription)(THIS_ LPCSTR pszName) PURE;
  836.  
  837.     STDMETHOD(GetWorkingDirectory)(THIS_ LPSTR pszDir, int cchMaxPath) PURE;
  838.     STDMETHOD(SetWorkingDirectory)(THIS_ LPCSTR pszDir) PURE;
  839.  
  840.     STDMETHOD(GetArguments)(THIS_ LPSTR pszArgs, int cchMaxPath) PURE;
  841.     STDMETHOD(SetArguments)(THIS_ LPCSTR pszArgs) PURE;
  842.  
  843.     STDMETHOD(GetHotkey)(THIS_ WORD *pwHotkey) PURE;
  844.     STDMETHOD(SetHotkey)(THIS_ WORD wHotkey) PURE;
  845.  
  846.     STDMETHOD(GetShowCmd)(THIS_ int *piShowCmd) PURE;
  847.     STDMETHOD(SetShowCmd)(THIS_ int iShowCmd) PURE;
  848.  
  849.     STDMETHOD(GetIconLocation)(THIS_ LPSTR pszIconPath, int cchIconPath, int *piIcon) PURE;
  850.     STDMETHOD(SetIconLocation)(THIS_ LPCSTR pszIconPath, int iIcon) PURE;
  851.  
  852.     STDMETHOD(SetRelativePath)(THIS_ LPCSTR pszPathRel, DWORD dwReserved) PURE;
  853.  
  854.     STDMETHOD(Resolve)(THIS_ HWND hwnd, DWORD fFlags) PURE;
  855.  
  856.     STDMETHOD(SetPath)(THIS_ LPCSTR pszFile) PURE;
  857. };
  858.  
  859. #undef  INTERFACE
  860. #define INTERFACE   IShellLinkW
  861.  
  862. DECLARE_INTERFACE_(IShellLinkW, IUnknown)       // sl
  863. {
  864.     // *** IUnknown methods ***
  865.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  866.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  867.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  868.  
  869.     STDMETHOD(GetPath)(THIS_ LPWSTR pszFile, int cchMaxPath, WIN32_FIND_DATAW *pfd, DWORD fFlags) PURE;
  870.  
  871.     STDMETHOD(GetIDList)(THIS_ LPITEMIDLIST * ppidl) PURE;
  872.     STDMETHOD(SetIDList)(THIS_ LPCITEMIDLIST pidl) PURE;
  873.  
  874.     STDMETHOD(GetDescription)(THIS_ LPWSTR pszName, int cchMaxName) PURE;
  875.     STDMETHOD(SetDescription)(THIS_ LPCWSTR pszName) PURE;
  876.  
  877.     STDMETHOD(GetWorkingDirectory)(THIS_ LPWSTR pszDir, int cchMaxPath) PURE;
  878.     STDMETHOD(SetWorkingDirectory)(THIS_ LPCWSTR pszDir) PURE;
  879.  
  880.     STDMETHOD(GetArguments)(THIS_ LPWSTR pszArgs, int cchMaxPath) PURE;
  881.     STDMETHOD(SetArguments)(THIS_ LPCWSTR pszArgs) PURE;
  882.  
  883.     STDMETHOD(GetHotkey)(THIS_ WORD *pwHotkey) PURE;
  884.     STDMETHOD(SetHotkey)(THIS_ WORD wHotkey) PURE;
  885.  
  886.     STDMETHOD(GetShowCmd)(THIS_ int *piShowCmd) PURE;
  887.     STDMETHOD(SetShowCmd)(THIS_ int iShowCmd) PURE;
  888.  
  889.     STDMETHOD(GetIconLocation)(THIS_ LPWSTR pszIconPath, int cchIconPath, int *piIcon) PURE;
  890.     STDMETHOD(SetIconLocation)(THIS_ LPCWSTR pszIconPath, int iIcon) PURE;
  891.  
  892.     STDMETHOD(SetRelativePath)(THIS_ LPCWSTR pszPathRel, DWORD dwReserved) PURE;
  893.  
  894.     STDMETHOD(Resolve)(THIS_ HWND hwnd, DWORD fFlags) PURE;
  895.  
  896.     STDMETHOD(SetPath)(THIS_ LPCWSTR pszFile) PURE;
  897. };
  898.  
  899. #ifdef _INC_SHELLAPI    /* for LPSHELLEXECUTEINFO */
  900. //===========================================================================
  901. //
  902. // IShellExecuteHook Interface
  903. //
  904. //===========================================================================
  905.  
  906. #undef  INTERFACE
  907. #define INTERFACE   IShellExecuteHookA
  908.  
  909. DECLARE_INTERFACE_(IShellExecuteHookA, IUnknown) // shexhk
  910. {
  911.     // *** IUnknown methods ***
  912.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  913.     STDMETHOD_(ULONG, AddRef) (THIS)  PURE;
  914.     STDMETHOD_(ULONG, Release) (THIS) PURE;
  915.  
  916.     // *** IShellExecuteHookA methods ***
  917.     STDMETHOD(Execute)(THIS_ LPSHELLEXECUTEINFOA pei) PURE;
  918. };
  919.  
  920. #undef  INTERFACE
  921. #define INTERFACE   IShellExecuteHookW
  922.  
  923. DECLARE_INTERFACE_(IShellExecuteHookW, IUnknown) // shexhk
  924. {
  925.     // *** IUnknown methods ***
  926.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  927.     STDMETHOD_(ULONG, AddRef) (THIS)  PURE;
  928.     STDMETHOD_(ULONG, Release) (THIS) PURE;
  929.  
  930.     // *** IShellExecuteHookW methods ***
  931.     STDMETHOD(Execute)(THIS_ LPSHELLEXECUTEINFOW pei) PURE;
  932. };
  933.  
  934. #ifdef UNICODE
  935. #define IShellExecuteHook       IShellExecuteHookW
  936. #define IShellExecuteHookVtbl   IShellExecuteHookWVtbl
  937. #else
  938. #define IShellExecuteHook       IShellExecuteHookA
  939. #define IShellExecuteHookVtbl   IShellExecuteHookAVtbl
  940. #endif
  941. #endif
  942.  
  943. //===========================================================================
  944. //
  945. // INewShortcutHook Interface
  946. //
  947. //===========================================================================
  948.  
  949. #undef  INTERFACE
  950. #define INTERFACE   INewShortcutHookA
  951.  
  952. DECLARE_INTERFACE_(INewShortcutHookA, IUnknown) // nshhk
  953. {
  954.     // *** IUnknown methods ***
  955.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  956.     STDMETHOD_(ULONG, AddRef) (THIS)  PURE;
  957.     STDMETHOD_(ULONG, Release) (THIS) PURE;
  958.  
  959.     // *** INewShortcutHook methods ***
  960.     STDMETHOD(SetReferent)(THIS_ LPCSTR pcszReferent, HWND hwnd) PURE;
  961.     STDMETHOD(GetReferent)(THIS_ LPSTR pszReferent, int cchReferent) PURE;
  962.     STDMETHOD(SetFolder)(THIS_ LPCSTR pcszFolder) PURE;
  963.     STDMETHOD(GetFolder)(THIS_ LPSTR pszFolder, int cchFolder) PURE;
  964.     STDMETHOD(GetName)(THIS_ LPSTR pszName, int cchName) PURE;
  965.     STDMETHOD(GetExtension)(THIS_ LPSTR pszExtension, int cchExtension) PURE;
  966. };
  967.  
  968. #undef  INTERFACE
  969. #define INTERFACE   INewShortcutHookW
  970.  
  971. DECLARE_INTERFACE_(INewShortcutHookW, IUnknown) // nshhk
  972. {
  973.     // *** IUnknown methods ***
  974.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  975.     STDMETHOD_(ULONG, AddRef) (THIS)  PURE;
  976.     STDMETHOD_(ULONG, Release) (THIS) PURE;
  977.  
  978.     // *** INewShortcutHook methods ***
  979.     STDMETHOD(SetReferent)(THIS_ LPCWSTR pcszReferent, HWND hwnd) PURE;
  980.     STDMETHOD(GetReferent)(THIS_ LPWSTR pszReferent, int cchReferent) PURE;
  981.     STDMETHOD(SetFolder)(THIS_ LPCWSTR pcszFolder) PURE;
  982.     STDMETHOD(GetFolder)(THIS_ LPWSTR pszFolder, int cchFolder) PURE;
  983.     STDMETHOD(GetName)(THIS_ LPWSTR pszName, int cchName) PURE;
  984.     STDMETHOD(GetExtension)(THIS_ LPWSTR pszExtension, int cchExtension) PURE;
  985. };
  986.  
  987. #ifdef UNICODE
  988. #define INewShortcutHook        INewShortcutHookW
  989. #define INewShortcutHookVtbl    INewShortcutHookWVtbl
  990. #else
  991. #define INewShortcutHook        INewShortcutHookA
  992. #define INewShortcutHookVtbl    INewShortcutHookAVtbl
  993. #endif
  994.  
  995. //===========================================================================
  996. //
  997. // ICopyHook Interface
  998. //
  999. //  The copy hook is called whenever file system directories are
  1000. //  copy/moved/deleted/renamed via the shell.  It is also called by the shell
  1001. //  on changes of status of printers.
  1002. //
  1003. //  Clients register their id under STRREG_SHEX_COPYHOOK for file system hooks
  1004. //  and STRREG_SHEx_PRNCOPYHOOK for printer hooks.
  1005. //  the CopyCallback is called prior to the action, so the hook has the chance
  1006. //  to allow, deny or cancel the operation by returning the falues:
  1007. //     IDYES  -  means allow the operation
  1008. //     IDNO   -  means disallow the operation on this file, but continue with
  1009. //              any other operations (eg. batch copy)
  1010. //     IDCANCEL - means disallow the current operation and cancel any pending
  1011. //              operations
  1012. //
  1013. //   arguments to the CopyCallback
  1014. //      hwnd - window to use for any UI
  1015. //      wFunc - what operation is being done
  1016. //      wFlags - and flags (FOF_*) set in the initial call to the file operation
  1017. //      pszSrcFile - name of the source file
  1018. //      dwSrcAttribs - file attributes of the source file
  1019. //      pszDestFile - name of the destiation file (for move and renames)
  1020. //      dwDestAttribs - file attributes of the destination file
  1021. //
  1022. //
  1023. //===========================================================================
  1024.  
  1025. #ifndef FO_MOVE //these need to be kept in sync with the ones in shellapi.h
  1026.  
  1027. // file operations
  1028.  
  1029. #define FO_MOVE           0x0001
  1030. #define FO_COPY           0x0002
  1031. #define FO_DELETE         0x0003
  1032. #define FO_RENAME         0x0004
  1033.  
  1034. #define FOF_MULTIDESTFILES         0x0001
  1035. #define FOF_CONFIRMMOUSE           0x0002
  1036. #define FOF_SILENT                 0x0004  // don't create progress/report
  1037. #define FOF_RENAMEONCOLLISION      0x0008
  1038. #define FOF_NOCONFIRMATION         0x0010  // Don't prompt the user.
  1039. #define FOF_WANTMAPPINGHANDLE      0x0020  // Fill in SHFILEOPSTRUCT.hNameMappings
  1040.                                       // Must be freed using SHFreeNameMappings
  1041. #define FOF_ALLOWUNDO              0x0040
  1042. #define FOF_FILESONLY              0x0080  // on *.*, do only files
  1043. #define FOF_SIMPLEPROGRESS         0x0100  // means don't show names of files
  1044. #define FOF_NOCONFIRMMKDIR         0x0200  // don't confirm making any needed dirs
  1045. #define FOF_NOERRORUI              0x0400  // don't put up error UI
  1046.  
  1047. typedef UINT FILEOP_FLAGS;
  1048.  
  1049. // printer operations
  1050.  
  1051. #define PO_DELETE       0x0013  // printer is being deleted
  1052. #define PO_RENAME       0x0014  // printer is being renamed
  1053. #define PO_PORTCHANGE   0x0020  // port this printer connected to is being changed
  1054.                                 // if this id is set, the strings received by
  1055.                                 // the copyhook are a doubly-null terminated
  1056.                                 // list of strings.  The first is the printer
  1057.                                 // name and the second is the printer port.
  1058. #define PO_REN_PORT     0x0034  // PO_RENAME and PO_PORTCHANGE at same time.
  1059.  
  1060. // no POF_ flags currently defined
  1061.  
  1062. typedef UINT PRINTEROP_FLAGS;
  1063.  
  1064. #endif // FO_MOVE
  1065.  
  1066. #undef  INTERFACE
  1067. #define INTERFACE   ICopyHookA
  1068.  
  1069. DECLARE_INTERFACE_(ICopyHookA, IUnknown)        // sl
  1070. {
  1071.     // *** IUnknown methods ***
  1072.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  1073.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  1074.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  1075.  
  1076.     STDMETHOD_(UINT,CopyCallback) (THIS_ HWND hwnd, UINT wFunc, UINT wFlags, LPCSTR pszSrcFile, DWORD dwSrcAttribs,
  1077.                                    LPCSTR pszDestFile, DWORD dwDestAttribs) PURE;
  1078. };
  1079.  
  1080. typedef ICopyHookA *    LPCOPYHOOKA;
  1081.  
  1082. #undef  INTERFACE
  1083. #define INTERFACE   ICopyHookW
  1084.  
  1085. DECLARE_INTERFACE_(ICopyHookW, IUnknown)        // sl
  1086. {
  1087.     // *** IUnknown methods ***
  1088.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  1089.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  1090.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  1091.  
  1092.     STDMETHOD_(UINT,CopyCallback) (THIS_ HWND hwnd, UINT wFunc, UINT wFlags, LPCWSTR pszSrcFile, DWORD dwSrcAttribs,
  1093.                                    LPCWSTR pszDestFile, DWORD dwDestAttribs) PURE;
  1094. };
  1095.  
  1096. typedef ICopyHookW *    LPCOPYHOOKW;
  1097.  
  1098. #ifdef UNICODE
  1099. #define ICopyHook       ICopyHookW
  1100. #define ICopyHookVtbl   ICopyHookWVtbl
  1101. #define LPCOPYHOOK      LPCOPYHOOKW
  1102. #else
  1103. #define ICopyHook       ICopyHookA
  1104. #define ICopyHookVtbl   ICopyHookAVtbl
  1105. #define LPCOPYHOOK      LPCOPYHOOKA
  1106. #endif
  1107.  
  1108. //===========================================================================
  1109. //
  1110. // IFileViewerSite Interface
  1111. //
  1112. //===========================================================================
  1113.  
  1114. #undef  INTERFACE
  1115. #define INTERFACE   IFileViewerSite
  1116.  
  1117. DECLARE_INTERFACE(IFileViewerSite)
  1118. {
  1119.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  1120.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  1121.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  1122.  
  1123.     STDMETHOD(SetPinnedWindow) (THIS_ HWND hwnd) PURE;
  1124.     STDMETHOD(GetPinnedWindow) (THIS_ HWND *phwnd) PURE;
  1125. };
  1126.  
  1127. typedef IFileViewerSite * LPFILEVIEWERSITE;
  1128.  
  1129.  
  1130. //===========================================================================
  1131. //
  1132. // IFileViewer Interface
  1133. //
  1134. // Implemented in a FileViewer component object.  Used to tell a
  1135. // FileViewer to PrintTo or to view, the latter happening though
  1136. // ShowInitialize and Show.  The filename is always given to the
  1137. // viewer through IPersistFile.
  1138. //
  1139. //===========================================================================
  1140.  
  1141. typedef struct
  1142. {
  1143.     // Stuff passed into viewer (in)
  1144.     DWORD cbSize;           // Size of structure for future expansion...
  1145.     HWND hwndOwner;         // who is the owner window.
  1146.     int iShow;              // The show command
  1147.  
  1148.     // Passed in and updated  (in/Out)
  1149.     DWORD dwFlags;          // flags
  1150.     RECT rect;              // Where to create the window may have defaults
  1151.     LPUNKNOWN punkRel;      // Relese this interface when window is visible
  1152.  
  1153.     // Stuff that might be returned from viewer (out)
  1154.     OLECHAR strNewFile[MAX_PATH];   // New File to view.
  1155.  
  1156. } FVSHOWINFO, *LPFVSHOWINFO;
  1157.  
  1158.     // Define File View Show Info Flags.
  1159. #define FVSIF_RECT      0x00000001      // The rect variable has valid data.
  1160. #define FVSIF_PINNED    0x00000002      // We should Initialize pinned
  1161.  
  1162. #define FVSIF_NEWFAILED 0x08000000      // The new file passed back failed
  1163.                                         // to be viewed.
  1164.  
  1165. #define FVSIF_NEWFILE   0x80000000      // A new file to view has been returned
  1166. #define FVSIF_CANVIEWIT 0x40000000      // The viewer can view it.
  1167.  
  1168. #undef  INTERFACE
  1169. #define INTERFACE   IFileViewerA
  1170.  
  1171. DECLARE_INTERFACE(IFileViewerA)
  1172. {
  1173.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  1174.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  1175.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  1176.  
  1177.     STDMETHOD(ShowInitialize) (THIS_ LPFILEVIEWERSITE lpfsi) PURE;
  1178.     STDMETHOD(Show) (THIS_ LPFVSHOWINFO pvsi) PURE;
  1179.     STDMETHOD(PrintTo) (THIS_ LPSTR pszDriver, BOOL fSuppressUI) PURE;
  1180. };
  1181.  
  1182. typedef IFileViewerA * LPFILEVIEWERA;
  1183.  
  1184. #undef  INTERFACE
  1185. #define INTERFACE   IFileViewerW
  1186.  
  1187. DECLARE_INTERFACE(IFileViewerW)
  1188. {
  1189.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  1190.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  1191.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  1192.  
  1193.     STDMETHOD(ShowInitialize) (THIS_ LPFILEVIEWERSITE lpfsi) PURE;
  1194.     STDMETHOD(Show) (THIS_ LPFVSHOWINFO pvsi) PURE;
  1195.     STDMETHOD(PrintTo) (THIS_ LPWSTR pszDriver, BOOL fSuppressUI) PURE;
  1196. };
  1197.  
  1198. typedef IFileViewerW * LPFILEVIEWERW;
  1199.  
  1200. #ifdef UNICODE
  1201. #define IFileViewer IFileViewerW
  1202. #define LPFILEVIEWER LPFILEVIEWERW
  1203. #else
  1204. #define IFileViewer IFileViewerA
  1205. #define LPFILEVIEWER LPFILEVIEWERA
  1206. #endif
  1207.  
  1208.  
  1209.  
  1210. // CommandTarget ids. for shell doc view wedge
  1211. enum {
  1212.         SHDVID_SETPROGRESSPOS,
  1213.         SHDVID_SETPROGRESSRANGE,
  1214.         SHDVID_SETSTATUSTEXT,    // variantIn  bstr
  1215.  
  1216.     SHDVID_REFRESH,
  1217.     SHDVID_STOP,
  1218.     SHDVID_UPDATECOMMANDS, /// this forces a re-querystatus of the command targets.
  1219.                            /// the arg in can specify a specific one to update or NULL for evrything
  1220.     SHDVID_SETTITLE,            // variantIn bstr
  1221.     SHDVID_FINALTITLEAVAIL,     // variantIn bstr - sent after final SETTITLE is sent
  1222.     SHDVID_STARTLOAD,           // NULL for everything
  1223.     SHDVID_STOPLOAD             // NULL for everything
  1224. #if MSOCT2
  1225.     ,SHDVID_CCALLBACK,          // callback to arbitrary C func
  1226.     SHDVID_MENUEXEC,            // do menu command
  1227.     SHDVID_MENUQS               // query menu commands
  1228. #endif
  1229. };
  1230.  
  1231.  
  1232.  
  1233. //==========================================================================
  1234. //
  1235. // IShellBrowser/IShellView/IShellFolder interface
  1236. //
  1237. //  These three interfaces are used when the shell communicates with
  1238. // name space extensions. The shell (explorer) provides IShellBrowser
  1239. // interface, and extensions implements IShellFolder and IShellView
  1240. // interfaces.
  1241. //
  1242. //==========================================================================
  1243.  
  1244.  
  1245. //--------------------------------------------------------------------------
  1246. //
  1247. // Command/menuitem IDs
  1248. //
  1249. //  The explorer dispatches WM_COMMAND messages based on the range of
  1250. // command/menuitem IDs. All the IDs of menuitems that the view (right
  1251. // pane) inserts must be in FCIDM_SHVIEWFIRST/LAST (otherwise, the explorer
  1252. // won't dispatch them). The view should not deal with any menuitems
  1253. // in FCIDM_BROWSERFIRST/LAST (otherwise, it won't work with the future
  1254. // version of the shell).
  1255. //
  1256. //  FCIDM_SHVIEWFIRST/LAST      for the right pane (IShellView)
  1257. //  FCIDM_BROWSERFIRST/LAST     for the explorer frame (IShellBrowser)
  1258. //  FCIDM_GLOBAL/LAST           for the explorer's submenu IDs
  1259. //
  1260. //--------------------------------------------------------------------------
  1261.  
  1262. #define FCIDM_SHVIEWFIRST           0x0000
  1263. #define FCIDM_SHVIEWLAST            0x7fff
  1264. #define FCIDM_BROWSERFIRST          0xa000
  1265. #define FCIDM_BROWSERLAST           0xbf00
  1266. #define FCIDM_GLOBALFIRST           0x8000
  1267. #define FCIDM_GLOBALLAST            0x9fff
  1268.  
  1269. //
  1270. // Global submenu IDs and separator IDs
  1271. //
  1272. #define FCIDM_MENU_FILE             (FCIDM_GLOBALFIRST+0x0000)
  1273. #define FCIDM_MENU_EDIT             (FCIDM_GLOBALFIRST+0x0040)
  1274. #define FCIDM_MENU_VIEW             (FCIDM_GLOBALFIRST+0x0080)
  1275. #define FCIDM_MENU_VIEW_SEP_OPTIONS (FCIDM_GLOBALFIRST+0x0081)
  1276. #define FCIDM_MENU_TOOLS            (FCIDM_GLOBALFIRST+0x00c0)
  1277. #define FCIDM_MENU_TOOLS_SEP_GOTO   (FCIDM_GLOBALFIRST+0x00c1)
  1278. #define FCIDM_MENU_HELP             (FCIDM_GLOBALFIRST+0x0100)
  1279. #define FCIDM_MENU_FIND             (FCIDM_GLOBALFIRST+0x0140)
  1280. #define FCIDM_MENU_EXPLORE          (FCIDM_GLOBALFIRST+0x0150)
  1281. #define FCIDM_MENU_FAVORITES        (FCIDM_GLOBALFIRST+0x0170)
  1282.  
  1283. //--------------------------------------------------------------------------
  1284. // control IDs known to the view
  1285. //--------------------------------------------------------------------------
  1286.  
  1287. #define FCIDM_TOOLBAR      (FCIDM_BROWSERFIRST + 0)
  1288. #define FCIDM_STATUS       (FCIDM_BROWSERFIRST + 1)
  1289.  
  1290.  
  1291. //--------------------------------------------------------------------------
  1292. //
  1293. // FOLDERSETTINGS
  1294. //
  1295. //  FOLDERSETTINGS is a data structure that explorer passes from one folder
  1296. // view to another, when the user is browsing. It calls ISV::GetCurrentInfo
  1297. // member to get the current settings and pass it to ISV::CreateViewWindow
  1298. // to allow the next folder view "inherit" it. These settings assumes a
  1299. // particular UI (which the shell's folder view has), and shell extensions
  1300. // may or may not use those settings.
  1301. //
  1302. //--------------------------------------------------------------------------
  1303.  
  1304. typedef LPBYTE LPVIEWSETTINGS;
  1305.  
  1306. // NB Bitfields.
  1307. // FWF_DESKTOP implies FWF_TRANSPARENT/NOCLIENTEDGE/NOSCROLL
  1308. typedef enum
  1309.     {
  1310.     FWF_AUTOARRANGE =       0x0001,
  1311.     FWF_ABBREVIATEDNAMES =  0x0002,
  1312.     FWF_SNAPTOGRID =        0x0004,
  1313.     FWF_OWNERDATA =         0x0008,
  1314.     FWF_BESTFITWINDOW =     0x0010,
  1315.     FWF_DESKTOP =           0x0020,
  1316.     FWF_SINGLESEL =         0x0040,
  1317.     FWF_NOSUBFOLDERS =      0x0080,
  1318.     FWF_TRANSPARENT  =      0x0100,
  1319.     FWF_NOCLIENTEDGE =      0x0200,
  1320.     FWF_NOSCROLL     =      0x0400,
  1321.     FWF_ALIGNLEFT    =      0x0800,
  1322.     FWF_SINGLECLICKACTIVATE=0x8000  // TEMPORARY -- NO UI FOR THIS
  1323.     } FOLDERFLAGS;
  1324.  
  1325. typedef enum
  1326.     {
  1327.     FVM_ICON =              1,
  1328.     FVM_SMALLICON =         2,
  1329.     FVM_LIST =              3,
  1330.     FVM_DETAILS =           4,
  1331.     } FOLDERVIEWMODE;
  1332.  
  1333. typedef struct
  1334.     {
  1335.     UINT ViewMode;       // View mode (FOLDERVIEWMODE values)
  1336.     UINT fFlags;         // View options (FOLDERFLAGS bits)
  1337.     } FOLDERSETTINGS, *LPFOLDERSETTINGS;
  1338.  
  1339. typedef const FOLDERSETTINGS * LPCFOLDERSETTINGS;
  1340.  
  1341.  
  1342. //--------------------------------------------------------------------------
  1343. //
  1344. // Interface:   IShellBrowser
  1345. //
  1346. //  IShellBrowser interface is the interface that is provided by the shell
  1347. // explorer/folder frame window. When it creates the "contents pane" of
  1348. // a shell folder (which provides IShellFolder interface), it calls its
  1349. // CreateViewObject member function to create an IShellView object. Then,
  1350. // it calls its CreateViewWindow member to create the "contents pane"
  1351. // window. The pointer to the IShellBrowser interface is passed to
  1352. // the IShellView object as a parameter to this CreateViewWindow member
  1353. // function call.
  1354. //
  1355. //    +--------------------------+  <-- Explorer window
  1356. //    | [] Explorer              |
  1357. //    |--------------------------+       IShellBrowser
  1358. //    | File Edit View ..        |
  1359. //    |--------------------------|
  1360. //    |        |                 |
  1361. //    |        |              <-------- Content pane
  1362. //    |        |                 |
  1363. //    |        |                 |       IShellView
  1364. //    |        |                 |
  1365. //    |        |                 |
  1366. //    +--------------------------+
  1367. //
  1368. //
  1369. //
  1370. // [Member functions]
  1371. //
  1372. //
  1373. // IShellBrowser::GetWindow(phwnd)
  1374. //
  1375. //   Inherited from IOleWindow::GetWindow.
  1376. //
  1377. //
  1378. // IShellBrowser::ContextSensitiveHelp(fEnterMode)
  1379. //
  1380. //   Inherited from IOleWindow::ContextSensitiveHelp.
  1381. //
  1382. //
  1383. // IShellBrowser::InsertMenusSB(hmenuShared, lpMenuWidths)
  1384. //
  1385. //   Similar to the IOleInPlaceFrame::InsertMenus. The explorer will put
  1386. //  "File" and "Edit" pulldown in the File menu group, "View" and "Tools"
  1387. //  in the Container menu group and "Help" in the Window menu group. Each
  1388. //  pulldown menu will have a uniqu ID, FCIDM_MENU_FILE/EDIT/VIEW/TOOLS/HELP.
  1389. //  The view is allowed to insert menuitems into those sub-menus by those
  1390. //  IDs must be between FCIDM_SHVIEWFIRST and FCIDM_SHVIEWLAST.
  1391. //
  1392. //
  1393. // IShellBrowser::SetMenuSB(hmenuShared, holemenu, hwndActiveObject)
  1394. //
  1395. //   Similar to the IOleInPlaceFrame::SetMenu. The explorer ignores the
  1396. //  holemenu parameter (reserved for future enhancement)  and performs
  1397. //  menu-dispatch based on the menuitem IDs (see the description above).
  1398. //  It is important to note that the explorer will add different
  1399. //  set of menuitems depending on whether the view has a focus or not.
  1400. //  Therefore, it is very important to call ISB::OnViewWindowActivate
  1401. //  whenever the view window (or its children) gets the focus.
  1402. //
  1403. //
  1404. // IShellBrowser::RemoveMenusSB(hmenuShared)
  1405. //
  1406. //   Same as the IOleInPlaceFrame::RemoveMenus.
  1407. //
  1408. //
  1409. // IShellBrowser::SetStatusTextSB(lpszStatusText)
  1410. //
  1411. //   Same as the IOleInPlaceFrame::SetStatusText. It is also possible to
  1412. //  send messages directly to the status window via SendControlMsg.
  1413. //
  1414. //
  1415. // IShellBrowser::EnableModelessSB(fEnable)
  1416. //
  1417. //   Same as the IOleInPlaceFrame::EnableModeless.
  1418. //
  1419. //
  1420. // IShellBrowser::TranslateAcceleratorSB(lpmsg, wID)
  1421. //
  1422. //   Same as the IOleInPlaceFrame::TranslateAccelerator, but will be
  1423. //  never called because we don't support EXEs (i.e., the explorer has
  1424. //  the message loop). This member function is defined here for possible
  1425. //  future enhancement.
  1426. //
  1427. //
  1428. // IShellBrowser::BrowseObject(pidl, wFlags)
  1429. //
  1430. //   The view calls this member to let shell explorer browse to another
  1431. //  folder. The pidl and wFlags specifies the folder to be browsed.
  1432. //
  1433. //  Following three flags specifies whether it creates another window or not.
  1434. //   SBSP_SAMEBROWSER  -- Browse to another folder with the same window.
  1435. //   SBSP_NEWBROWSER   -- Creates another window for the specified folder.
  1436. //   SBSP_DEFBROWSER   -- Default behavior (respects the view option).
  1437. //
  1438. //  Following three flags specifies open, explore, or default mode. These   .
  1439. //  are ignored if SBSP_SAMEBROWSER or (SBSP_DEFBROWSER && (single window   .
  1440. //  browser || explorer)).                                                  .
  1441. //   SBSP_OPENMODE     -- Use a normal folder window
  1442. //   SBSP_EXPLOREMODE  -- Use an explorer window
  1443. //   SBSP_DEFMODE      -- Use the same as the current window
  1444. //
  1445. //  Following three flags specifies the pidl.
  1446. //   SBSP_ABSOLUTE -- pidl is an absolute pidl (relative from desktop)
  1447. //   SBSP_RELATIVE -- pidl is relative from the current folder.
  1448. //   SBSP_PARENT   -- Browse the parent folder (ignores the pidl)
  1449. //
  1450. //
  1451. // IShellBrowser::GetViewStateStream(grfMode, ppstm)
  1452. //
  1453. //   The browser returns an IStream interface as the storage for view
  1454. //  specific state information.
  1455. //
  1456. //   grfMode -- Specifies the read/write access (STGM_READ/WRITE/READWRITE)
  1457. //   ppstm   -- Specifies the LPSTREAM variable to be filled.
  1458. //
  1459. //
  1460. // IShellBrowser::GetControlWindow(id, phwnd)
  1461. //
  1462. //   The shell view may call this member function to get the window handle
  1463. //  of Explorer controls (toolbar or status winodw -- FCW_TOOLBAR or
  1464. //  FCW_STATUS).
  1465. //
  1466. //
  1467. // IShellBrowser::SendControlMsg(id, uMsg, wParam, lParam, pret)
  1468. //
  1469. //   The shell view calls this member function to send control messages to
  1470. //  one of Explorer controls (toolbar or status window -- FCW_TOOLBAR or
  1471. //  FCW_STATUS).
  1472. //
  1473. //
  1474. // IShellBrowser::QueryActiveShellView(IShellView * ppshv)
  1475. //
  1476. //   This member returns currently activated (displayed) shellview object.
  1477. //  A shellview never need to call this member function.
  1478. //
  1479. //
  1480. // IShellBrowser::OnViewWindowActive(pshv)
  1481. //
  1482. //   The shell view window calls this member function when the view window
  1483. //  (or one of its children) got the focus. It MUST call this member before
  1484. //  calling IShellBrowser::InsertMenus, because it will insert different
  1485. //  set of menu items depending on whether the view has the focus or not.
  1486. //
  1487. //
  1488. // IShellBrowser::SetToolbarItems(lpButtons, nButtons, uFlags)
  1489. //
  1490. //   The view calls this function to add toolbar items to the exporer's
  1491. //  toolbar. "lpButtons" and "nButtons" specifies the array of toolbar
  1492. //  items. "uFlags" must be one of FCT_MERGE, FCT_CONFIGABLE, FCT_ADDTOEND.
  1493. //
  1494. //-------------------------------------------------------------------------
  1495.  
  1496. #undef  INTERFACE
  1497. #define INTERFACE   IShellBrowser
  1498.  
  1499. //
  1500. // Values for wFlags parameter of ISB::BrowseObject() member.
  1501. //
  1502. #define SBSP_DEFBROWSER  0x0000
  1503. #define SBSP_SAMEBROWSER 0x0001
  1504. #define SBSP_NEWBROWSER  0x0002
  1505.  
  1506. #define SBSP_DEFMODE     0x0000
  1507. #define SBSP_OPENMODE    0x0010
  1508. #define SBSP_EXPLOREMODE 0x0020
  1509.  
  1510. #define SBSP_ABSOLUTE    0x0000
  1511. #define SBSP_RELATIVE    0x1000
  1512. #define SBSP_PARENT      0x2000
  1513.  
  1514. #define SBSP_INITIATEDBYHLINKFRAME        0x80000000
  1515. #define SBSP_REDIRECT                     0x40000000
  1516.  
  1517. //
  1518. // Values for id parameter of ISB::GetWindow/SendControlMsg members.
  1519. //
  1520. // WARNING:
  1521. //  Any shell extensions which sends messages to those control windows
  1522. // might not work in the future version of windows. If you really need
  1523. // to send messages to them, (1) don't assume that those control window
  1524. // always exist (i.e. GetControlWindow may fail) and (2) verify the window
  1525. // class of the window before sending any messages.
  1526. //
  1527. #define FCW_STATUS      0x0001
  1528. #define FCW_TOOLBAR     0x0002
  1529. #define FCW_TREE        0x0003
  1530.  
  1531. //
  1532. // Values for uFlags paremeter of ISB::SetToolbarItems member.
  1533. //
  1534. #define FCT_MERGE       0x0001
  1535. #define FCT_CONFIGABLE  0x0002
  1536. #define FCT_ADDTOEND    0x0004
  1537.  
  1538.  
  1539. DECLARE_INTERFACE_(IShellBrowser, IOleWindow)
  1540. {
  1541.     // *** IUnknown methods ***
  1542.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  1543.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  1544.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  1545.  
  1546.     // *** IOleWindow methods ***
  1547.     STDMETHOD(GetWindow) (THIS_ HWND * lphwnd) PURE;
  1548.     STDMETHOD(ContextSensitiveHelp) (THIS_ BOOL fEnterMode) PURE;
  1549.  
  1550.     // *** IShellBrowser methods *** (same as IOleInPlaceFrame)
  1551.     STDMETHOD(InsertMenusSB) (THIS_ HMENU hmenuShared,
  1552.                                 LPOLEMENUGROUPWIDTHS lpMenuWidths) PURE;
  1553.     STDMETHOD(SetMenuSB) (THIS_ HMENU hmenuShared, HOLEMENU holemenuReserved,
  1554.                 HWND hwndActiveObject) PURE;
  1555.     STDMETHOD(RemoveMenusSB) (THIS_ HMENU hmenuShared) PURE;
  1556.     STDMETHOD(SetStatusTextSB) (THIS_ LPCOLESTR lpszStatusText) PURE;
  1557.     STDMETHOD(EnableModelessSB) (THIS_ BOOL fEnable) PURE;
  1558.     STDMETHOD(TranslateAcceleratorSB) (THIS_ LPMSG lpmsg, WORD wID) PURE;
  1559.  
  1560.     // *** IShellBrowser methods ***
  1561.     STDMETHOD(BrowseObject)(THIS_ LPCITEMIDLIST pidl, UINT wFlags) PURE;
  1562.     STDMETHOD(GetViewStateStream)(THIS_ DWORD grfMode,
  1563.                 LPSTREAM  *ppStrm) PURE;
  1564.     STDMETHOD(GetControlWindow)(THIS_ UINT id, HWND * lphwnd) PURE;
  1565.     STDMETHOD(SendControlMsg)(THIS_ UINT id, UINT uMsg, WPARAM wParam,
  1566.                 LPARAM lParam, LRESULT * pret) PURE;
  1567.     STDMETHOD(QueryActiveShellView)(THIS_ struct IShellView ** ppshv) PURE;
  1568.     STDMETHOD(OnViewWindowActive)(THIS_ struct IShellView * ppshv) PURE;
  1569.     STDMETHOD(SetToolbarItems)(THIS_ LPTBBUTTON lpButtons, UINT nButtons,
  1570.                 UINT uFlags) PURE;
  1571. };
  1572.  
  1573. typedef IShellBrowser * LPSHELLBROWSER;
  1574.  
  1575. enum {
  1576.         SBSC_HIDE = 0,
  1577.         SBSC_SHOW = 1,
  1578.         SBSC_TOGGLE = 2,
  1579.         SBSC_QUERY =  3
  1580. };
  1581.  
  1582. // CommandTarget ids.
  1583. enum {
  1584.         SBCMDID_ENABLESHOWTREE,
  1585.         SBCMDID_SHOWCONTROL,            // variant vt_i4 = loword = FCW_* hiword = SBSC_*
  1586.         SBCMDID_CANCELNAVIGATION,       // cancel last navigation
  1587.         SBCMDID_MAYSAVECHANGES,         // about to close and may save changes
  1588.         SBCMDID_SETHLINKFRAME,          // variant vt_i4 = phlinkframe
  1589.         SBCMDID_ENABLESTOP,             // variant vt_bool = fEnable
  1590.         SBCMDID_OPTIONS,                // the view.options page
  1591. };
  1592.  
  1593.  
  1594. //-------------------------------------------------------------------------
  1595. // ICommDlgBrowser interface
  1596. //
  1597. //  ICommDlgBrowser interface is the interface that is provided by the new
  1598. // common dialog window to hook and modify the behavior of IShellView.  When
  1599. // a default view is created, it queries its parent IShellBrowser for the
  1600. // ICommDlgBrowser interface.  If supported, it calls out to that interface
  1601. // in several cases that need to behave differently in a dialog.
  1602. //
  1603. // Member functions:
  1604. //
  1605. //  ICommDlgBrowser::OnDefaultCommand()
  1606. //    Called when the user double-clicks in the view or presses Enter.  The
  1607. //   browser should return S_OK if it processed the action itself, S_FALSE
  1608. //   to let the view perform the default action.
  1609. //
  1610. //  ICommDlgBrowser::OnStateChange(ULONG uChange)
  1611. //    Called when some states in the view change.  'uChange' is one of the
  1612. //   CDBOSC_* values.  This call is made after the state (selection, focus,
  1613. //   etc) has changed.  There is no return value.
  1614. //
  1615. //  ICommDlgBrowser::IncludeObject(LPCITEMIDLIST pidl)
  1616. //    Called when the view is enumerating objects.  'pidl' is a relative
  1617. //   IDLIST.  The browser should return S_OK to include the object in the
  1618. //   view, S_FALSE to hide it
  1619. //
  1620. //-------------------------------------------------------------------------
  1621.  
  1622. #undef  INTERFACE
  1623. #define INTERFACE   ICommDlgBrowser
  1624.  
  1625. #define CDBOSC_SETFOCUS     0x00000000
  1626. #define CDBOSC_KILLFOCUS    0x00000001
  1627. #define CDBOSC_SELCHANGE    0x00000002
  1628. #define CDBOSC_RENAME       0x00000003
  1629.  
  1630. DECLARE_INTERFACE_(ICommDlgBrowser, IUnknown)
  1631. {
  1632.     // *** IUnknown methods ***
  1633.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  1634.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  1635.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  1636.  
  1637.     // *** ICommDlgBrowser methods ***
  1638.     STDMETHOD(OnDefaultCommand) (THIS_ struct IShellView * ppshv) PURE;
  1639.     STDMETHOD(OnStateChange) (THIS_ struct IShellView * ppshv,
  1640.                 ULONG uChange) PURE;
  1641.     STDMETHOD(IncludeObject) (THIS_ struct IShellView * ppshv,
  1642.                 LPCITEMIDLIST pidl) PURE;
  1643. };
  1644.  
  1645. typedef ICommDlgBrowser * LPCOMMDLGBROWSER;
  1646.  
  1647.  
  1648. //==========================================================================
  1649. //
  1650. // Interface:   IShellView
  1651. //
  1652. // IShellView::GetWindow(phwnd)
  1653. //
  1654. //   Inherited from IOleWindow::GetWindow.
  1655. //
  1656. //
  1657. // IShellView::ContextSensitiveHelp(fEnterMode)
  1658. //
  1659. //   Inherited from IOleWindow::ContextSensitiveHelp.
  1660. //
  1661. //
  1662. // IShellView::TranslateAccelerator(lpmsg)
  1663. //
  1664. //   Similar to IOleInPlaceActiveObject::TranlateAccelerator. The explorer
  1665. //  calls this function BEFORE any other translation. Returning S_OK
  1666. //  indicates that the message was translated (eaten) and should not be
  1667. //  translated or dispatched by the explorer.
  1668. //
  1669. //
  1670. // IShellView::EnableModeless(fEnable)
  1671. //   Similar to IOleInPlaceActiveObject::EnableModeless.
  1672. //
  1673. //
  1674. // IShellView::UIActivate(uState)
  1675. //
  1676. //   The explorer calls this member function whenever the activation
  1677. //  state of the view window is changed by a certain event that is
  1678. //  NOT caused by the shell view itself.
  1679. //
  1680. //   SVUIA_DEACTIVATE will be passed when the explorer is about to
  1681. //  destroy the shell view window; the shell view is supposed to remove
  1682. //  all the extended UIs (typically merged menu and modeless popup windows).
  1683. //
  1684. //   SVUIA_ACTIVATE_NOFOCUS will be passsed when the shell view is losing
  1685. //  the input focus or the shell view has been just created without the
  1686. //  input focus; the shell view is supposed to set menuitems appropriate
  1687. //  for non-focused state (no selection specific items should be added).
  1688. //
  1689. //   SVUIA_ACTIVATE_FOCUS will be passed when the explorer has just
  1690. //  created the view window with the input focus; the shell view is
  1691. //  supposed to set menuitems appropriate for focused state.
  1692. //
  1693. //   SVUIA_INPLACEACTIVATE(new) will be passed when the shell view is opened
  1694. //  within an ActiveX control, which is not a UI active. In this case,
  1695. //  the shell view should not merge menus or put toolbas. To be compatible
  1696. //  with Win95 client, we don't pass this value unless the view supports
  1697. //  IShellView2.
  1698. //
  1699. //   The shell view should not change focus within this member function.
  1700. //  The shell view should not hook the WM_KILLFOCUS message to remerge
  1701. //  menuitems. However, the shell view typically hook the WM_SETFOCUS
  1702. //  message, and re-merge the menu after calling IShellBrowser::
  1703. //  OnViewWindowActivated.
  1704. //
  1705. //
  1706. // IShellView::Refresh()
  1707. //
  1708. //   The explorer calls this member when the view needs to refresh its
  1709. //  contents (such as when the user hits F5 key).
  1710. //
  1711. //
  1712. // IShellView::CreateViewWindow
  1713. //
  1714. //   This member creates the view window (right-pane of the explorer or the
  1715. //  client window of the folder window).
  1716. //
  1717. //
  1718. // IShellView::DestroyViewWindow
  1719. //
  1720. //   This member destroys the view window.
  1721. //
  1722. //
  1723. // IShellView::GetCurrentInfo
  1724. //
  1725. //   This member returns the folder settings.
  1726. //
  1727. //
  1728. // IShellView::AddPropertySHeetPages
  1729. //
  1730. //   The explorer calls this member when it is opening the option property
  1731. //  sheet. This allows the view to add additional pages to it.
  1732. //
  1733. //
  1734. // IShellView::SaveViewState()
  1735. //
  1736. //   The explorer calls this member when the shell view is supposed to
  1737. //  store its view settings. The shell view is supposed to get a view
  1738. //  stream by calling IShellBrowser::GetViewStateStream and store the
  1739. //  current view state into that stream.
  1740. //
  1741. //
  1742. // IShellView::SelectItem(pidlItem, uFlags)
  1743. //
  1744. //   The explorer calls this member to change the selection state of
  1745. //  item(s) within the shell view window.  If pidlItem is NULL and uFlags
  1746. //  is SVSI_DESELECTOTHERS, all items should be deselected.
  1747. //
  1748. //-------------------------------------------------------------------------
  1749.  
  1750. #undef  INTERFACE
  1751. #define INTERFACE   IShellView
  1752.  
  1753. //
  1754. // shellview select item flags
  1755. //
  1756. #define SVSI_DESELECT   0x0000
  1757. #define SVSI_SELECT     0x0001
  1758. #define SVSI_EDIT       0x0003  // includes select
  1759. #define SVSI_DESELECTOTHERS 0x0004
  1760. #define SVSI_ENSUREVISIBLE  0x0008
  1761. #define SVSI_FOCUSED        0x0010
  1762.  
  1763. //
  1764. // shellview get item object flags
  1765. //
  1766. #define SVGIO_BACKGROUND    0x00000000
  1767. #define SVGIO_SELECTION     0x00000001
  1768. #define SVGIO_ALLVIEW       0x00000002
  1769.  
  1770. //
  1771. // uState values for IShellView::UIActivate
  1772. //
  1773. typedef enum {
  1774.     SVUIA_DEACTIVATE       = 0,
  1775.     SVUIA_ACTIVATE_NOFOCUS = 1,
  1776.     SVUIA_ACTIVATE_FOCUS   = 2,
  1777.     SVUIA_INPLACEACTIVATE  = 3          // new flag for IShellView2
  1778. } SVUIA_STATUS;
  1779.  
  1780. DECLARE_INTERFACE_(IShellView, IOleWindow)
  1781. {
  1782.     // *** IUnknown methods ***
  1783.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  1784.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  1785.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  1786.  
  1787.     // *** IOleWindow methods ***
  1788.     STDMETHOD(GetWindow) (THIS_ HWND * lphwnd) PURE;
  1789.     STDMETHOD(ContextSensitiveHelp) (THIS_ BOOL fEnterMode) PURE;
  1790.  
  1791.     // *** IShellView methods ***
  1792.     STDMETHOD(TranslateAccelerator) (THIS_ LPMSG lpmsg) PURE;
  1793. #ifdef _FIX_ENABLEMODELESS_CONFLICT
  1794.     STDMETHOD(EnableModelessSV) (THIS_ BOOL fEnable) PURE;
  1795. #else
  1796.     STDMETHOD(EnableModeless) (THIS_ BOOL fEnable) PURE;
  1797. #endif
  1798.     STDMETHOD(UIActivate) (THIS_ UINT uState) PURE;
  1799.     STDMETHOD(Refresh) (THIS) PURE;
  1800.  
  1801.     STDMETHOD(CreateViewWindow)(THIS_ IShellView  *lpPrevView,
  1802.                     LPCFOLDERSETTINGS lpfs, IShellBrowser  * psb,
  1803.                     RECT * prcView, HWND  *phWnd) PURE;
  1804.     STDMETHOD(DestroyViewWindow)(THIS) PURE;
  1805.     STDMETHOD(GetCurrentInfo)(THIS_ LPFOLDERSETTINGS lpfs) PURE;
  1806.     STDMETHOD(AddPropertySheetPages)(THIS_ DWORD dwReserved,
  1807.                     LPFNADDPROPSHEETPAGE lpfn, LPARAM lparam) PURE;
  1808.     STDMETHOD(SaveViewState)(THIS) PURE;
  1809.     STDMETHOD(SelectItem)(THIS_ LPCITEMIDLIST pidlItem, UINT uFlags) PURE;
  1810.     STDMETHOD(GetItemObject)(THIS_ UINT uItem, REFIID riid,
  1811.                     LPVOID *ppv) PURE;
  1812. };
  1813.  
  1814. typedef IShellView *    LPSHELLVIEW;
  1815.  
  1816. typedef GUID SHELLVIEWID;
  1817.  
  1818. #define SV2GV_CURRENTVIEW ((UINT)-1)
  1819. #define SV2GV_DEFAULTVIEW ((UINT)-2)
  1820.  
  1821. typedef struct _SV2CVW2_PARAMS
  1822. {
  1823.         DWORD cbSize;
  1824.  
  1825.         IShellView *psvPrev;
  1826.         FOLDERSETTINGS const *pfs;
  1827.         IShellBrowser *psbOwner;
  1828.         RECT *prcView;
  1829.         SHELLVIEWID const *pvid;
  1830.  
  1831.         HWND hwndView;
  1832. } SV2CVW2_PARAMS;
  1833. typedef SV2CVW2_PARAMS *LPSV2CVW2_PARAMS;
  1834.  
  1835. #undef  INTERFACE
  1836. #define INTERFACE   IShellView2
  1837.  
  1838. DECLARE_INTERFACE_(IShellView2, IShellView)
  1839. {
  1840.     // *** IUnknown methods ***
  1841.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  1842.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  1843.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  1844.  
  1845.     // *** IOleWindow methods ***
  1846.     STDMETHOD(GetWindow) (THIS_ HWND * lphwnd) PURE;
  1847.     STDMETHOD(ContextSensitiveHelp) (THIS_ BOOL fEnterMode) PURE;
  1848.  
  1849.     // *** IShellView methods ***
  1850.     STDMETHOD(TranslateAccelerator) (THIS_ LPMSG lpmsg) PURE;
  1851. #ifdef _FIX_ENABLEMODELESS_CONFLICT
  1852.     STDMETHOD(EnableModelessSV) (THIS_ BOOL fEnable) PURE;
  1853. #else
  1854.     STDMETHOD(EnableModeless) (THIS_ BOOL fEnable) PURE;
  1855. #endif
  1856.     STDMETHOD(UIActivate) (THIS_ UINT uState) PURE;
  1857.     STDMETHOD(Refresh) (THIS) PURE;
  1858.  
  1859.     STDMETHOD(CreateViewWindow)(THIS_ IShellView  *lpPrevView,
  1860.                     LPCFOLDERSETTINGS lpfs, IShellBrowser  * psb,
  1861.                     RECT * prcView, HWND  *phWnd) PURE;
  1862.     STDMETHOD(DestroyViewWindow)(THIS) PURE;
  1863.     STDMETHOD(GetCurrentInfo)(THIS_ LPFOLDERSETTINGS lpfs) PURE;
  1864.     STDMETHOD(AddPropertySheetPages)(THIS_ DWORD dwReserved,
  1865.                     LPFNADDPROPSHEETPAGE lpfn, LPARAM lparam) PURE;
  1866.     STDMETHOD(SaveViewState)(THIS) PURE;
  1867.     STDMETHOD(SelectItem)(THIS_ LPCITEMIDLIST pidlItem, UINT uFlags) PURE;
  1868.     STDMETHOD(GetItemObject)(THIS_ UINT uItem, REFIID riid,
  1869.                     LPVOID *ppv) PURE;
  1870.  
  1871.     // *** IShellView2 methods ***
  1872.     STDMETHOD(GetView)(THIS_ SHELLVIEWID* pvid, ULONG uView) PURE;
  1873.     STDMETHOD(CreateViewWindow2)(THIS_ LPSV2CVW2_PARAMS lpParams) PURE;
  1874. };
  1875.  
  1876. //-------------------------------------------------------------------------
  1877. //
  1878. // struct STRRET
  1879. //
  1880. // structure for returning strings from IShellFolder member functions
  1881. //
  1882. //-------------------------------------------------------------------------
  1883. #define STRRET_WSTR     0x0000          // Use STRRET.pOleStr
  1884. #define STRRET_OFFSET   0x0001          // Use STRRET.uOffset to Ansi
  1885. #define STRRET_CSTR     0x0002          // Use STRRET.cStr
  1886.  
  1887.  
  1888. typedef struct _STRRET
  1889. {
  1890.     UINT uType; // One of the STRRET_* values
  1891.     union
  1892.     {
  1893.         LPWSTR          pOleStr;        // OLESTR that will be freed
  1894.         LPSTR           pStr;           // ANSI string that will be freed (needed?)
  1895.         UINT            uOffset;        // Offset into SHITEMID
  1896.         char            cStr[MAX_PATH]; // Buffer to fill in (ANSI)
  1897.     } DUMMYUNIONNAME;
  1898. } STRRET, *LPSTRRET;
  1899.  
  1900.  
  1901. //-------------------------------------------------------------------------
  1902. //
  1903. // SHGetPathFromIDList
  1904. //
  1905. //  This function assumes the size of the buffer (MAX_PATH). The pidl
  1906. // should point to a file system object.
  1907. //
  1908. //-------------------------------------------------------------------------
  1909.  
  1910. WINSHELLAPI BOOL WINAPI SHGetPathFromIDListA(LPCITEMIDLIST pidl, LPSTR pszPath);
  1911. WINSHELLAPI BOOL WINAPI SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath);
  1912.  
  1913. #ifdef UNICODE
  1914. #define SHGetPathFromIDList SHGetPathFromIDListW
  1915. #else
  1916. #define SHGetPathFromIDList SHGetPathFromIDListA
  1917. #endif
  1918.  
  1919.  
  1920. //-------------------------------------------------------------------------
  1921. //
  1922. // SHGetSpecialFolderLocation
  1923. //
  1924. //  Caller should call SHFree to free the returned pidl.
  1925. //
  1926. //-------------------------------------------------------------------------
  1927. //
  1928. // registry entries for special paths are kept in :
  1929. #define REGSTR_PATH_SPECIAL_FOLDERS    REGSTR_PATH_EXPLORER TEXT("\\Shell Folders")
  1930.  
  1931.  
  1932.  
  1933. #define CSIDL_DESKTOP                   0x0000
  1934. #define CSIDL_PROGRAMS                  0x0002
  1935. #define CSIDL_CONTROLS                  0x0003
  1936. #define CSIDL_PRINTERS                  0x0004
  1937. #define CSIDL_PERSONAL                  0x0005
  1938. #define CSIDL_FAVORITES                 0x0006
  1939. #define CSIDL_STARTUP                   0x0007
  1940. #define CSIDL_RECENT                    0x0008
  1941. #define CSIDL_SENDTO                    0x0009
  1942. #define CSIDL_BITBUCKET                 0x000a
  1943. #define CSIDL_STARTMENU                 0x000b
  1944. #define CSIDL_DESKTOPDIRECTORY          0x0010
  1945. #define CSIDL_DRIVES                    0x0011
  1946. #define CSIDL_NETWORK                   0x0012
  1947. #define CSIDL_NETHOOD                   0x0013
  1948. #define CSIDL_FONTS                     0x0014
  1949. #define CSIDL_TEMPLATES                 0x0015
  1950. #define CSIDL_COMMON_STARTMENU          0x0016
  1951. #define CSIDL_COMMON_PROGRAMS           0X0017
  1952. #define CSIDL_COMMON_STARTUP            0x0018
  1953. #define CSIDL_COMMON_DESKTOPDIRECTORY   0x0019
  1954. #define CSIDL_APPDATA                   0x001a
  1955. #define CSIDL_PRINTHOOD                 0x001b
  1956.  
  1957. WINSHELLAPI HRESULT WINAPI SHGetSpecialFolderLocation(HWND hwndOwner, int nFolder, LPITEMIDLIST * ppidl);
  1958.  
  1959. //-------------------------------------------------------------------------
  1960. //
  1961. // SHBrowseForFolder API
  1962. //
  1963. //-------------------------------------------------------------------------
  1964.  
  1965. typedef int (CALLBACK* BFFCALLBACK)(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData);
  1966.  
  1967. typedef struct _browseinfoA {
  1968.     HWND        hwndOwner;
  1969.     LPCITEMIDLIST pidlRoot;
  1970.     LPSTR        pszDisplayName;// Return display name of item selected.
  1971.     LPCSTR       lpszTitle;      // text to go in the banner over the tree.
  1972.     UINT         ulFlags;       // Flags that control the return stuff
  1973.     BFFCALLBACK  lpfn;
  1974.     LPARAM      lParam;         // extra info that's passed back in callbacks
  1975.  
  1976.     int          iImage;      // output var: where to return the Image index.
  1977. } BROWSEINFOA, *PBROWSEINFOA, *LPBROWSEINFOA;
  1978.  
  1979. typedef struct _browseinfoW {
  1980.     HWND        hwndOwner;
  1981.     LPCITEMIDLIST pidlRoot;
  1982.     LPWSTR       pszDisplayName;// Return display name of item selected.
  1983.     LPCWSTR      lpszTitle;      // text to go in the banner over the tree.
  1984.     UINT         ulFlags;       // Flags that control the return stuff
  1985.     BFFCALLBACK  lpfn;
  1986.     LPARAM      lParam;         // extra info that's passed back in callbacks
  1987.  
  1988.     int          iImage;      // output var: where to return the Image index.
  1989. } BROWSEINFOW, *PBROWSEINFOW, *LPBROWSEINFOW;
  1990.  
  1991. #ifdef UNICODE
  1992. #define BROWSEINFO      BROWSEINFOW
  1993. #define PBROWSEINFO     PBROWSEINFOW
  1994. #define LPBROWSEINFO    LPBROWSEINFOW
  1995. #else
  1996. #define BROWSEINFO      BROWSEINFOA
  1997. #define PBROWSEINFO     PBROWSEINFOA
  1998. #define LPBROWSEINFO    LPBROWSEINFOA
  1999. #endif
  2000.  
  2001. // Browsing for directory.
  2002. #define BIF_RETURNONLYFSDIRS   0x0001  // For finding a folder to start document searching
  2003. #define BIF_DONTGOBELOWDOMAIN  0x0002  // For starting the Find Computer
  2004. #define BIF_STATUSTEXT         0x0004
  2005. #define BIF_RETURNFSANCESTORS  0x0008
  2006.  
  2007. #define BIF_BROWSEFORCOMPUTER  0x1000  // Browsing for Computers.
  2008. #define BIF_BROWSEFORPRINTER   0x2000  // Browsing for Printers
  2009. #define BIF_BROWSEINCLUDEFILES 0x4000  // Browsing for Everything
  2010.  
  2011. // message from browser
  2012. #define BFFM_INITIALIZED        1
  2013. #define BFFM_SELCHANGED         2
  2014.  
  2015. // messages to browser
  2016. #define BFFM_SETSTATUSTEXTA     (WM_USER + 100)
  2017. #define BFFM_ENABLEOK           (WM_USER + 101)
  2018. #define BFFM_SETSELECTIONA      (WM_USER + 102)
  2019. #define BFFM_SETSELECTIONW      (WM_USER + 103)
  2020. #define BFFM_SETSTATUSTEXTW     (WM_USER + 104)
  2021.  
  2022.  
  2023. WINSHELLAPI LPITEMIDLIST WINAPI SHBrowseForFolderA(LPBROWSEINFOA lpbi);
  2024. WINSHELLAPI LPITEMIDLIST WINAPI SHBrowseForFolderW(LPBROWSEINFOW lpbi);
  2025.  
  2026. #ifdef UNICODE
  2027. #define SHBrowseForFolder   SHBrowseForFolderW
  2028. #define BFFM_SETSTATUSTEXT  BFFM_SETSTATUSTEXTW
  2029. #define BFFM_SETSELECTION   BFFM_SETSELECTIONW
  2030. #else
  2031. #define SHBrowseForFolder   SHBrowseForFolderA
  2032. #define BFFM_SETSTATUSTEXT  BFFM_SETSTATUSTEXTA
  2033. #define BFFM_SETSELECTION   BFFM_SETSELECTIONA
  2034. #endif
  2035.  
  2036. //-------------------------------------------------------------------------
  2037. //
  2038. // SHLoadInProc
  2039. //
  2040. //   When this function is called, the shell calls CoCreateInstance
  2041. //  (or equivalent) with CLSCTX_INPROC_SERVER and the specified CLSID
  2042. //  from within the shell's process and release it immediately.
  2043. //
  2044. //-------------------------------------------------------------------------
  2045.  
  2046. WINSHELLAPI HRESULT WINAPI SHLoadInProc(REFCLSID rclsid);
  2047.  
  2048.  
  2049. //-------------------------------------------------------------------------
  2050. //
  2051. // IEnumIDList interface
  2052. //
  2053. //  IShellFolder::EnumObjects member returns an IEnumIDList object.
  2054. //
  2055. //-------------------------------------------------------------------------
  2056.  
  2057. typedef struct IEnumIDList      *LPENUMIDLIST;
  2058.  
  2059. #undef  INTERFACE
  2060. #define INTERFACE       IEnumIDList
  2061.  
  2062. DECLARE_INTERFACE_(IEnumIDList, IUnknown)
  2063. {
  2064.     // *** IUnknown methods ***
  2065.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  2066.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  2067.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  2068.  
  2069.     // *** IEnumIDList methods ***
  2070.     STDMETHOD(Next)  (THIS_ ULONG celt,
  2071.                       LPITEMIDLIST *rgelt,
  2072.                       ULONG *pceltFetched) PURE;
  2073.     STDMETHOD(Skip)  (THIS_ ULONG celt) PURE;
  2074.     STDMETHOD(Reset) (THIS) PURE;
  2075.     STDMETHOD(Clone) (THIS_ IEnumIDList **ppenum) PURE;
  2076. };
  2077.  
  2078.  
  2079. //-------------------------------------------------------------------------
  2080. //
  2081. // IShellFolder interface
  2082. //
  2083. //
  2084. // [Member functions]
  2085. //
  2086. // IShellFolder::BindToObject(pidl, pbc, riid, ppvOut)
  2087. //   This function returns an instance of a sub-folder which is specified
  2088. //  by the IDList (pidl).
  2089. //
  2090. // IShellFolder::BindToStorage(pidl, pbc, riid, ppvObj)
  2091. //   This function returns a storage instance of a sub-folder which is
  2092. //  specified by the IDList (pidl). The shell never calls this member
  2093. //  function in the first release of Win95.
  2094. //
  2095. // IShellFolder::CompareIDs(lParam, pidl1, pidl2)
  2096. //   This function compares two IDLists and returns the result. The shell
  2097. //  explorer always passes 0 as lParam, which indicates "sort by name".
  2098. //  It should return 0 (as CODE of the scode), if two id indicates the
  2099. //  same object; negative value if pidl1 should be placed before pidl2;
  2100. //  positive value if pidl2 should be placed before pidl1.
  2101. //
  2102. // IShellFolder::CreateViewObject(hwndOwner, riid, ppvOut)
  2103. //   This function creates a view object of the folder itself. The view
  2104. //  object is a difference instance from the shell folder object.
  2105. //   "hwndOwner" can be used  as the owner window of its dialog box or
  2106. //      menu during the lifetime of the view object.
  2107. //  instance which has only one reference count. The explorer may create
  2108. //  more than one instances of view object from one shell folder object
  2109. //  and treat them as separate instances.
  2110. //
  2111. // IShellFolder::GetAttributesOf(cidl, apidl, prgfInOut)
  2112. //   This function returns the attributes of specified objects in that
  2113. //  folder. "cidl" and "apidl" specifies objects. "apidl" contains only
  2114. //  simple IDLists. The explorer initializes *prgfInOut with a set of
  2115. //  flags to be evaluated. The shell folder may optimize the operation
  2116. //  by not returning unspecified flags.
  2117. //
  2118. // IShellFolder::GetUIObjectOf(hwndOwner, cidl, apidl, riid, prgfInOut, ppvOut)
  2119. //   This function creates a UI object to be used for specified objects.
  2120. //  The shell explorer passes either IID_IDataObject (for transfer operation)
  2121. //  or IID_IContextMenu (for context menu operation) as riid.
  2122. //
  2123. // IShellFolder::GetDisplayNameOf
  2124. //   This function returns the display name of the specified object.
  2125. //  If the ID contains the display name (in the locale character set),
  2126. //  it returns the offset to the name. Otherwise, it returns a pointer
  2127. //  to the display name string (UNICODE), which is allocated by the
  2128. //  task allocator, or fills in a buffer.
  2129. //
  2130. // IShellFolder::SetNameOf
  2131. //   This function sets the display name of the specified object.
  2132. //  If it changes the ID as well, it returns the new ID which is
  2133. //  alocated by the task allocator.
  2134. //
  2135. //-------------------------------------------------------------------------
  2136.  
  2137. #undef  INTERFACE
  2138. #define INTERFACE       IShellFolder
  2139.  
  2140. // IShellFolder::GetDisplayNameOf/SetNameOf uFlags
  2141. typedef enum tagSHGDN
  2142. {
  2143.     SHGDN_NORMAL            = 0,        // default (display purpose)
  2144.     SHGDN_INFOLDER          = 1,        // displayed under a folder (relative)
  2145.     SHGDN_FORADDRESSBAR     = 0x4000,   // for displaying in the address (drives dropdown) bar
  2146.     SHGDN_FORPARSING        = 0x8000,   // for ParseDisplayName or path
  2147. } SHGNO;
  2148.  
  2149. // IShellFolder::EnumObjects
  2150. typedef enum tagSHCONTF
  2151. {
  2152.     SHCONTF_FOLDERS         = 32,       // for shell browser
  2153.     SHCONTF_NONFOLDERS      = 64,       // for default view
  2154.     SHCONTF_INCLUDEHIDDEN   = 128,      // for hidden/system objects
  2155. } SHCONTF;
  2156.  
  2157. // IShellFolder::GetAttributesOf flags
  2158. #define SFGAO_CANCOPY           DROPEFFECT_COPY // Objects can be copied
  2159. #define SFGAO_CANMOVE           DROPEFFECT_MOVE // Objects can be moved
  2160. #define SFGAO_CANLINK           DROPEFFECT_LINK // Objects can be linked
  2161. #define SFGAO_CANRENAME         0x00000010L     // Objects can be renamed
  2162. #define SFGAO_CANDELETE         0x00000020L     // Objects can be deleted
  2163. #define SFGAO_HASPROPSHEET      0x00000040L     // Objects have property sheets
  2164. #define SFGAO_DROPTARGET        0x00000100L     // Objects are drop target
  2165. #define SFGAO_CAPABILITYMASK    0x00000177L
  2166. #define SFGAO_LINK              0x00010000L     // Shortcut (link)
  2167. #define SFGAO_SHARE             0x00020000L     // shared
  2168. #define SFGAO_READONLY          0x00040000L     // read-only
  2169. #define SFGAO_GHOSTED           0x00080000L     // ghosted icon
  2170. #define SFGAO_DISPLAYATTRMASK   0x000F0000L
  2171. #define SFGAO_FILESYSANCESTOR   0x10000000L     // It contains file system folder
  2172. #define SFGAO_FOLDER            0x20000000L     // It's a folder.
  2173. #define SFGAO_FILESYSTEM        0x40000000L     // is a file system thing (file/folder/root)
  2174. #define SFGAO_HASSUBFOLDER      0x80000000L     // Expandable in the map pane
  2175. #define SFGAO_CONTENTSMASK      0x80000000L
  2176. #define SFGAO_VALIDATE          0x01000000L     // invalidate cached information
  2177. #define SFGAO_REMOVABLE         0x02000000L     // is this removeable media?
  2178. #define SFGAO_COMPRESSED        0x04000000L     // Object is compressed (use alt color)
  2179.  
  2180. DECLARE_INTERFACE_(IShellFolder, IUnknown)
  2181. {
  2182.     // *** IUnknown methods ***
  2183.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  2184.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  2185.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  2186.  
  2187.     // *** IShellFolder methods ***
  2188.     STDMETHOD(ParseDisplayName) (THIS_ HWND hwndOwner,
  2189.         LPBC pbcReserved, LPOLESTR lpszDisplayName,
  2190.         ULONG * pchEaten, LPITEMIDLIST * ppidl, ULONG *pdwAttributes) PURE;
  2191.  
  2192.     STDMETHOD(EnumObjects) ( THIS_ HWND hwndOwner, DWORD grfFlags, LPENUMIDLIST * ppenumIDList) PURE;
  2193.  
  2194.     STDMETHOD(BindToObject)     (THIS_ LPCITEMIDLIST pidl, LPBC pbcReserved,
  2195.                                  REFIID riid, LPVOID * ppvOut) PURE;
  2196.     STDMETHOD(BindToStorage)    (THIS_ LPCITEMIDLIST pidl, LPBC pbcReserved,
  2197.                                  REFIID riid, LPVOID * ppvObj) PURE;
  2198.     STDMETHOD(CompareIDs)       (THIS_ LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2) PURE;
  2199.     STDMETHOD(CreateViewObject) (THIS_ HWND hwndOwner, REFIID riid, LPVOID * ppvOut) PURE;
  2200.     STDMETHOD(GetAttributesOf)  (THIS_ UINT cidl, LPCITEMIDLIST * apidl,
  2201.                                     ULONG * rgfInOut) PURE;
  2202.     STDMETHOD(GetUIObjectOf)    (THIS_ HWND hwndOwner, UINT cidl, LPCITEMIDLIST * apidl,
  2203.                                  REFIID riid, UINT * prgfInOut, LPVOID * ppvOut) PURE;
  2204.     STDMETHOD(GetDisplayNameOf) (THIS_ LPCITEMIDLIST pidl, DWORD uFlags, LPSTRRET lpName) PURE;
  2205.     STDMETHOD(SetNameOf)        (THIS_ HWND hwndOwner, LPCITEMIDLIST pidl,
  2206.                                  LPCOLESTR lpszName, DWORD uFlags,
  2207.                                  LPITEMIDLIST * ppidlOut) PURE;
  2208. };
  2209.  
  2210. typedef IShellFolder * LPSHELLFOLDER;
  2211.  
  2212. //
  2213. //  Helper function which returns a IShellFolder interface to the desktop
  2214. // folder. This is equivalent to call CoCreateInstance with CLSID_ShellDesktop.
  2215. //
  2216. //  CoCreateInstance(CLSID_Desktop, NULL,
  2217. //                   CLSCTX_INPROC, IID_IShellFolder, &pshf);
  2218. //
  2219. WINSHELLAPI HRESULT WINAPI SHGetDesktopFolder(LPSHELLFOLDER *ppshf);
  2220.  
  2221.  
  2222.  
  2223.  
  2224. //==========================================================================
  2225. // Clipboard format which may be supported by IDataObject from system
  2226. // defined shell folders (such as directories, network, ...).
  2227. //==========================================================================
  2228.  
  2229. #define CFSTR_SHELLIDLIST       TEXT("Shell IDList Array")      // CF_IDLIST
  2230. #define CFSTR_SHELLIDLISTOFFSET TEXT("Shell Object Offsets")    // CF_OBJECTPOSITIONS
  2231. #define CFSTR_NETRESOURCES      TEXT("Net Resource")            // CF_NETRESOURCE
  2232. #define CFSTR_FILEDESCRIPTORA   TEXT("FileGroupDescriptor")     // CF_FILEGROUPDESCRIPTORA
  2233. #define CFSTR_FILEDESCRIPTORW   TEXT("FileGroupDescriptorW")    // CF_FILEGROUPDESCRIPTORW
  2234. #define CFSTR_FILECONTENTS      TEXT("FileContents")            // CF_FILECONTENTS
  2235. #define CFSTR_FILENAMEA         TEXT("FileName")                // CF_FILENAMEA
  2236. #define CFSTR_FILENAMEW         TEXT("FileNameW")               // CF_FILENAMEW
  2237. #define CFSTR_PRINTERGROUP      TEXT("PrinterFriendlyName")     // CF_PRINTERS
  2238. #define CFSTR_FILENAMEMAPA      TEXT("FileNameMap")             // CF_FILENAMEMAPA
  2239. #define CFSTR_FILENAMEMAPW      TEXT("FileNameMapW")            // CF_FILENAMEMAPW
  2240. #define CFSTR_PREFERREDDROPEFFECT TEXT("Preferred DropEffect")
  2241.  
  2242. #ifdef UNICODE
  2243. #define CFSTR_FILEDESCRIPTOR    CFSTR_FILEDESCRIPTORW
  2244. #define CFSTR_FILENAME          CFSTR_FILENAMEW
  2245. #define CFSTR_FILENAMEMAP       CFSTR_FILENAMEMAPW
  2246. #else
  2247. #define CFSTR_FILEDESCRIPTOR    CFSTR_FILEDESCRIPTORA
  2248. #define CFSTR_FILENAME          CFSTR_FILENAMEA
  2249. #define CFSTR_FILENAMEMAP       CFSTR_FILENAMEMAPA
  2250. #endif
  2251.  
  2252. //
  2253. // CF_OBJECTPOSITIONS
  2254. //
  2255. //
  2256.  
  2257.  
  2258.  
  2259. #define DVASPECT_SHORTNAME      2 // use for CF_HDROP to get short name version
  2260. //
  2261. // format of CF_NETRESOURCE
  2262. //
  2263. typedef struct _NRESARRAY {     // anr
  2264.     UINT cItems;
  2265.     NETRESOURCE nr[1];
  2266. } NRESARRAY, * LPNRESARRAY;
  2267.  
  2268. //
  2269. // format of CF_IDLIST
  2270. //
  2271. typedef struct _IDA {
  2272.     UINT cidl;          // number of relative IDList
  2273.     UINT aoffset[1];    // [0]: folder IDList, [1]-[cidl]: item IDList
  2274. } CIDA, * LPIDA;
  2275.  
  2276. //
  2277. // FILEDESCRIPTOR.dwFlags field indicate which fields are to be used
  2278. //
  2279. typedef enum {
  2280.     FD_CLSID            = 0x0001,
  2281.     FD_SIZEPOINT        = 0x0002,
  2282.     FD_ATTRIBUTES       = 0x0004,
  2283.     FD_CREATETIME       = 0x0008,
  2284.     FD_ACCESSTIME       = 0x0010,
  2285.     FD_WRITESTIME       = 0x0020,
  2286.     FD_FILESIZE         = 0x0040,
  2287.     FD_LINKUI           = 0x8000,       // 'link' UI is prefered
  2288. } FD_FLAGS;
  2289.  
  2290. typedef struct _FILEDESCRIPTORA { // fod
  2291.     DWORD dwFlags;
  2292.  
  2293.     CLSID clsid;
  2294.     SIZEL sizel;
  2295.     POINTL pointl;
  2296.  
  2297.     DWORD dwFileAttributes;
  2298.     FILETIME ftCreationTime;
  2299.     FILETIME ftLastAccessTime;
  2300.     FILETIME ftLastWriteTime;
  2301.     DWORD nFileSizeHigh;
  2302.     DWORD nFileSizeLow;
  2303.     CHAR   cFileName[ MAX_PATH ];
  2304. } FILEDESCRIPTORA, *LPFILEDESCRIPTORA;
  2305.  
  2306. typedef struct _FILEDESCRIPTORW { // fod
  2307.     DWORD dwFlags;
  2308.  
  2309.     CLSID clsid;
  2310.     SIZEL sizel;
  2311.     POINTL pointl;
  2312.  
  2313.     DWORD dwFileAttributes;
  2314.     FILETIME ftCreationTime;
  2315.     FILETIME ftLastAccessTime;
  2316.     FILETIME ftLastWriteTime;
  2317.     DWORD nFileSizeHigh;
  2318.     DWORD nFileSizeLow;
  2319.     WCHAR  cFileName[ MAX_PATH ];
  2320. } FILEDESCRIPTORW, *LPFILEDESCRIPTORW;
  2321.  
  2322. #ifdef UNICODE
  2323. #define FILEDESCRIPTOR      FILEDESCRIPTORW
  2324. #define LPFILEDESCRIPTOR    LPFILEDESCRIPTORW
  2325. #else
  2326. #define FILEDESCRIPTOR      FILEDESCRIPTORA
  2327. #define LPFILEDESCRIPTOR    LPFILEDESCRIPTORA
  2328. #endif
  2329.  
  2330. //
  2331. // format of CF_FILEGROUPDESCRIPTOR
  2332. //
  2333. typedef struct _FILEGROUPDESCRIPTORA { // fgd
  2334.      UINT cItems;
  2335.      FILEDESCRIPTORA fgd[1];
  2336. } FILEGROUPDESCRIPTORA, * LPFILEGROUPDESCRIPTORA;
  2337.  
  2338. typedef struct _FILEGROUPDESCRIPTORW { // fgd
  2339.      UINT cItems;
  2340.      FILEDESCRIPTORW fgd[1];
  2341. } FILEGROUPDESCRIPTORW, * LPFILEGROUPDESCRIPTORW;
  2342.  
  2343. #ifdef UNICODE
  2344. #define FILEGROUPDESCRIPTOR     FILEGROUPDESCRIPTORW
  2345. #define LPFILEGROUPDESCRIPTOR   LPFILEGROUPDESCRIPTORW
  2346. #else
  2347. #define FILEGROUPDESCRIPTOR     FILEGROUPDESCRIPTORA
  2348. #define LPFILEGROUPDESCRIPTOR   LPFILEGROUPDESCRIPTORA
  2349. #endif
  2350.  
  2351. //
  2352. // format of CF_HDROP and CF_PRINTERS, in the HDROP case the data that follows
  2353. // is a double null terinated list of file names, for printers they are printer
  2354. // friendly names
  2355. //
  2356. typedef struct _DROPFILES {
  2357.    DWORD pFiles;                       // offset of file list
  2358.    POINT pt;                           // drop point (client coords)
  2359.    BOOL fNC;                           // is it on NonClient area
  2360.                                        // and pt is in screen coords
  2361.    BOOL fWide;                         // WIDE character switch
  2362. } DROPFILES, FAR * LPDROPFILES;
  2363.  
  2364.  
  2365. //====== File System Notification APIs ===============================
  2366. //
  2367.  
  2368.  
  2369.  
  2370. //
  2371. //  File System Notification flags
  2372. //
  2373.  
  2374.  
  2375.  
  2376. #define SHCNE_RENAMEITEM          0x00000001L
  2377. #define SHCNE_CREATE              0x00000002L
  2378. #define SHCNE_DELETE              0x00000004L
  2379. #define SHCNE_MKDIR               0x00000008L
  2380. #define SHCNE_RMDIR               0x00000010L
  2381. #define SHCNE_MEDIAINSERTED       0x00000020L
  2382. #define SHCNE_MEDIAREMOVED        0x00000040L
  2383. #define SHCNE_DRIVEREMOVED        0x00000080L
  2384. #define SHCNE_DRIVEADD            0x00000100L
  2385. #define SHCNE_NETSHARE            0x00000200L
  2386. #define SHCNE_NETUNSHARE          0x00000400L
  2387. #define SHCNE_ATTRIBUTES          0x00000800L
  2388. #define SHCNE_UPDATEDIR           0x00001000L
  2389. #define SHCNE_UPDATEITEM          0x00002000L
  2390. #define SHCNE_SERVERDISCONNECT    0x00004000L
  2391. #define SHCNE_UPDATEIMAGE         0x00008000L
  2392. #define SHCNE_DRIVEADDGUI         0x00010000L
  2393. #define SHCNE_RENAMEFOLDER        0x00020000L
  2394. #define SHCNE_FREESPACE           0x00040000L
  2395. #define SHCNE_EXTENDED_EVENT      0x00080000L // Extended Event.
  2396.  
  2397. #define SHCNE_ASSOCCHANGED        0x08000000L
  2398.  
  2399. #define SHCNE_DISKEVENTS          0x0002381FL
  2400. #define SHCNE_GLOBALEVENTS        0x0C0D81E0L // Events that dont match pidls first
  2401. #define SHCNE_ALLEVENTS           0x7FFFFFFFL
  2402. #define SHCNE_INTERRUPT           0x80000000L // The presence of this flag indicates
  2403.                                             // that the event was generated by an
  2404.                                             // interrupt.  It is stripped out before
  2405.                                             // the clients of SHCNNotify_ see it.
  2406.  
  2407. #define SHCNEE_THEMECHANGED       0x00000001L  // The theme changed
  2408.  
  2409.  
  2410. // Flags
  2411. // uFlags & SHCNF_TYPE is an ID which indicates what dwItem1 and dwItem2 mean
  2412. #define SHCNF_IDLIST      0x0000        // LPITEMIDLIST
  2413. #define SHCNF_PATHA       0x0001        // path name
  2414. #define SHCNF_PRINTERA    0x0002        // printer friendly name
  2415. #define SHCNF_DWORD       0x0003        // DWORD
  2416. #define SHCNF_PATHW       0x0005        // path name
  2417. #define SHCNF_PRINTERW    0x0006        // printer friendly name
  2418. #define SHCNF_TYPE        0x00FF
  2419. #define SHCNF_FLUSH       0x1000
  2420. #define SHCNF_FLUSHNOWAIT 0x2000
  2421.  
  2422. #ifdef UNICODE
  2423. #define SHCNF_PATH      SHCNF_PATHW
  2424. #define SHCNF_PRINTER   SHCNF_PRINTERW
  2425. #else
  2426. #define SHCNF_PATH      SHCNF_PATHA
  2427. #define SHCNF_PRINTER   SHCNF_PRINTERA
  2428. #endif
  2429.  
  2430.  
  2431.  
  2432. //
  2433. //  APIs
  2434. //
  2435. WINSHELLAPI void WINAPI SHChangeNotify(LONG wEventId, UINT uFlags,
  2436.                                 LPCVOID dwItem1, LPCVOID dwItem2);
  2437.  
  2438. //
  2439. // SHAddToRecentDocs
  2440. //
  2441. #define SHARD_PIDL      0x00000001L
  2442. #define SHARD_PATHA     0x00000002L
  2443. #define SHARD_PATHW     0x00000003L
  2444.  
  2445. #ifdef UNICODE
  2446. #define SHARD_PATH  SHARD_PATHW
  2447. #else
  2448. #define SHARD_PATH  SHARD_PATHA
  2449. #endif
  2450.  
  2451. WINSHELLAPI void WINAPI SHAddToRecentDocs(UINT uFlags, LPCVOID pv);
  2452.  
  2453.  
  2454.  
  2455.  
  2456. WINSHELLAPI HRESULT WINAPI SHGetInstanceExplorer(IUnknown **ppunk);
  2457.  
  2458. //
  2459. // SHGetDataFromIDListA/W
  2460. //
  2461. #define SHGDFIL_FINDDATA        1
  2462. #define SHGDFIL_NETRESOURCE     2
  2463. #define SHGDFIL_DESCRIPTIONID   3
  2464.  
  2465. #define SHDID_ROOT_REGITEM          1
  2466. #define SHDID_FS_FILE               2
  2467. #define SHDID_FS_DIRECTORY          3
  2468. #define SHDID_FS_OTHER              4
  2469. #define SHDID_COMPUTER_DRIVE35      5
  2470. #define SHDID_COMPUTER_DRIVE525     6
  2471. #define SHDID_COMPUTER_REMOVABLE    7
  2472. #define SHDID_COMPUTER_FIXED        8
  2473. #define SHDID_COMPUTER_NETDRIVE     9
  2474. #define SHDID_COMPUTER_CDROM        10
  2475. #define SHDID_COMPUTER_RAMDISK      11
  2476. #define SHDID_COMPUTER_OTHER        12
  2477. #define SHDID_NET_DOMAIN            13
  2478. #define SHDID_NET_SERVER            14
  2479. #define SHDID_NET_SHARE             15
  2480. #define SHDID_NET_RESTOFNET         16
  2481. #define SHDID_NET_OTHER             17
  2482.  
  2483. typedef struct _SHDESCRIPTIONID {
  2484.     DWORD   dwDescriptionId;
  2485.     CLSID   clsid;
  2486. } SHDESCRIPTIONID, *LPSHDESCRIPTIONID;
  2487.  
  2488. WINSHELLAPI HRESULT WINAPI SHGetDataFromIDListA(LPSHELLFOLDER psf, LPCITEMIDLIST pidl,
  2489.         int nFormat, PVOID pv, int cb);
  2490. WINSHELLAPI HRESULT WINAPI SHGetDataFromIDListW(LPSHELLFOLDER psf, LPCITEMIDLIST pidl,
  2491.         int nFormat, PVOID pv, int cb);
  2492.  
  2493. #ifdef UNICODE
  2494. #define SHGetDataFromIDList SHGetDataFromIDListW
  2495. #else
  2496. #define SHGetDataFromIDList SHGetDataFromIDListA
  2497. #endif
  2498.  
  2499. #ifdef __cplusplus
  2500. }
  2501.  
  2502. #endif  /* __cplusplus */
  2503.  
  2504. #ifndef RC_INVOKED
  2505. #pragma pack()
  2506. #endif  /* !RC_INVOKED */
  2507.  
  2508. #endif // _SHLOBJ_H_
  2509.