home *** CD-ROM | disk | FTP | other *** search
/ PC Format (South-Africa) 2001 May / PCFMay2001.iso / Xenon / C++ / FreeCommandLineTools.exe / Include / shlobj.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-01-31  |  190.4 KB  |  4,937 lines

  1. //===========================================================================
  2. //
  3. // Copyright (c) Microsoft Corporation 1991-1998
  4. //
  5. // File: shlobj.h
  6. //
  7. //===========================================================================
  8.  
  9. #ifndef _SHLOBJ_H_
  10. #pragma option push -b -a8 -pc -A- /*P_O_Push*/
  11. #define _SHLOBJ_H_
  12.  
  13. #ifndef _WINRESRC_
  14. #ifndef _WIN32_IE
  15. #define _WIN32_IE 0x0501
  16. #else
  17. #if (_WIN32_IE < 0x0400) && defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0500)
  18. #error _WIN32_IE setting conflicts with _WIN32_WINNT setting
  19. #endif
  20. #endif
  21. #endif
  22.  
  23. #ifndef SNDMSG
  24. #ifdef __cplusplus
  25. #define SNDMSG ::SendMessage
  26. #else
  27. #define SNDMSG SendMessage
  28. #endif
  29. #endif // ifndef SNDMSG
  30.  
  31. //
  32. // Define API decoration for direct importing of DLL references.
  33. //
  34. #ifndef WINSHELLAPI
  35. #if defined(_SHELL32_)
  36. #define WINSHELLAPI
  37. #else
  38. #define WINSHELLAPI       DECLSPEC_IMPORT
  39. #endif
  40. #endif // WINSHELLAPI
  41.  
  42. #ifndef SHSTDAPI
  43. #if defined(_SHELL32_)
  44. #define SHSTDAPI          STDAPI
  45. #define SHSTDAPI_(type)   STDAPI_(type)
  46. #else
  47. #define SHSTDAPI          EXTERN_C DECLSPEC_IMPORT HRESULT STDAPICALLTYPE
  48. #define SHSTDAPI_(type)   EXTERN_C DECLSPEC_IMPORT type STDAPICALLTYPE
  49. #endif
  50. #endif // SHSTDAPI
  51.  
  52. #ifndef SHDOCAPI
  53. #if defined(_SHDOCVW_)
  54. #define SHDOCAPI          STDAPI
  55. #define SHDOCAPI_(type)   STDAPI_(type)
  56. #else
  57. #define SHDOCAPI          EXTERN_C DECLSPEC_IMPORT HRESULT STDAPICALLTYPE
  58. #define SHDOCAPI_(type)   EXTERN_C DECLSPEC_IMPORT type STDAPICALLTYPE
  59. #endif
  60. #endif // SHDOCAPI
  61.  
  62. // shell32 APIs that are also exported from shdocvw
  63. #ifndef SHSTDDOCAPI
  64. #if defined(_SHDOCVW_) || defined(_SHELL32_)
  65. #define SHSTDDOCAPI          STDAPI
  66. #define SHSTDDOCAPI_(type)   STDAPI_(type)
  67. #else
  68. #define SHSTDDOCAPI          EXTERN_C DECLSPEC_IMPORT HRESULT STDAPICALLTYPE
  69. #define SHSTDDOCAPI_(type)   EXTERN_C DECLSPEC_IMPORT type STDAPICALLTYPE
  70. #endif
  71. #endif // SHSTDDOCAPI
  72.  
  73. #ifndef BROWSEUIAPI
  74. #if defined(_BROWSEUI_)
  75. #define BROWSEUIAPI           STDAPI
  76. #define BROWSEUIAPI_(type)    STDAPI_(type)
  77. #else
  78. #define BROWSEUIAPI           EXTERN_C DECLSPEC_IMPORT HRESULT STDAPICALLTYPE
  79. #define BROWSEUIAPI_(type)    EXTERN_C DECLSPEC_IMPORT type STDAPICALLTYPE
  80. #endif // defined(_BROWSEUI_)
  81. #endif // BROWSEUIAPI
  82.  
  83. // shell32 APIs that are also exported from shfolder
  84. #ifndef SHFOLDERAPI
  85. #if defined(_SHFOLDER_) || defined(_SHELL32_)
  86. #define SHFOLDERAPI           STDAPI
  87. #else
  88. #define SHFOLDERAPI           EXTERN_C DECLSPEC_IMPORT HRESULT STDAPICALLTYPE
  89. #endif
  90. #endif
  91.  
  92.  
  93.  
  94. #include <ole2.h>
  95. #ifndef _PRSHT_H_
  96. #include <prsht.h>
  97. #endif
  98. #ifndef _INC_COMMCTRL
  99. #include <commctrl.h>   // for LPTBBUTTON
  100. #endif
  101.  
  102. #ifndef INITGUID
  103. #include <shlguid.h>
  104. #endif /* !INITGUID */
  105.  
  106. #ifndef RC_INVOKED
  107. #include <pshpack1.h>   /* Assume byte packing throughout */
  108. #endif /* !RC_INVOKED */
  109.  
  110. #ifdef __cplusplus
  111. extern "C" {            /* Assume C declarations for C++ */
  112. #endif /* __cplusplus */
  113.  
  114.  
  115. //===========================================================================
  116. //
  117. // Object identifiers in the explorer's name space (ItemID and IDList)
  118. //
  119. //  All the items that the user can browse with the explorer (such as files,
  120. // directories, servers, work-groups, etc.) has an identifier which is unique
  121. // among items within the parent folder. Those identifiers are called item
  122. // IDs (SHITEMID). Since all its parent folders have their own item IDs,
  123. // any items can be uniquely identified by a list of item IDs, which is called
  124. // an ID list (ITEMIDLIST).
  125. //
  126. //  ID lists are almost always allocated by the task allocator (see some
  127. // description below as well as OLE 2.0 SDK) and may be passed across
  128. // some of shell interfaces (such as IShellFolder). Each item ID in an ID list
  129. // is only meaningful to its parent folder (which has generated it), and all
  130. // the clients must treat it as an opaque binary data except the first two
  131. // bytes, which indicates the size of the item ID.
  132. //
  133. //  When a shell extension -- which implements the IShellFolder interace --
  134. // generates an item ID, it may put any information in it, not only the data
  135. // with that it needs to identifies the item, but also some additional
  136. // information, which would help implementing some other functions efficiently.
  137. // For example, the shell's IShellFolder implementation of file system items
  138. // stores the primary (long) name of a file or a directory as the item
  139. // identifier, but it also stores its alternative (short) name, size and date
  140. // etc.
  141. //
  142. //  When an ID list is passed to one of shell APIs (such as SHGetPathFromIDList),
  143. // it is always an absolute path -- relative from the root of the name space,
  144. // which is the desktop folder. When an ID list is passed to one of IShellFolder
  145. // member function, it is always a relative path from the folder (unless it
  146. // is explicitly specified).
  147. //
  148. //===========================================================================
  149.  
  150. //
  151. // SHITEMID -- Item ID
  152. //
  153. typedef struct _SHITEMID        // mkid
  154. {
  155.     USHORT      cb;             // Size of the ID (including cb itself)
  156.     BYTE        abID[1];        // The item ID (variable length)
  157. } SHITEMID;
  158. typedef UNALIGNED SHITEMID *LPSHITEMID;
  159. typedef const UNALIGNED SHITEMID *LPCSHITEMID;
  160.  
  161. //
  162. // ITEMIDLIST -- List if item IDs (combined with 0-terminator)
  163. //
  164. typedef struct _ITEMIDLIST      // idl
  165. {
  166.     SHITEMID    mkid;
  167. } ITEMIDLIST;
  168. typedef UNALIGNED ITEMIDLIST * LPITEMIDLIST;
  169. typedef const UNALIGNED ITEMIDLIST * LPCITEMIDLIST;
  170.  
  171. //===========================================================================
  172. //
  173. // Task allocator API
  174. //
  175. //  All the shell extensions MUST use the task allocator (see OLE 2.0
  176. // programming guild for its definition) when they allocate or free
  177. // memory objects (mostly ITEMIDLIST) that are returned across any
  178. // shell interfaces. There are two ways to access the task allocator
  179. // from a shell extension depending on whether or not it is linked with
  180. // OLE32.DLL or not (purely for efficiency).
  181. //
  182. // (1) A shell extension which calls any OLE API (i.e., linked with
  183. //  OLE32.DLL) should call OLE's task allocator (by retrieving
  184. //  the task allocator by calling CoGetMalloc API).
  185. //
  186. // (2) A shell extension which does not call any OLE API (i.e., not linked
  187. //  with OLE32.DLL) should call the shell task allocator API (defined
  188. //  below), so that the shell can quickly loads it when OLE32.DLL is not
  189. //  loaded by any application at that point.
  190. //
  191. // Notes:
  192. //  In next version of Windowso release, SHGetMalloc will be replaced by
  193. // the following macro.
  194. //
  195. // #define SHGetMalloc(ppmem)   CoGetMalloc(MEMCTX_TASK, ppmem)
  196. //
  197. //===========================================================================
  198.  
  199. SHSTDAPI SHGetMalloc(LPMALLOC * ppMalloc);
  200.  
  201.  
  202. //===========================================================================
  203. //
  204. // IContextMenu interface
  205. //
  206. // [OverView]
  207. //
  208. //  The shell uses the IContextMenu interface in following three cases.
  209. //
  210. // case-1: The shell is loading context menu extensions.
  211. //
  212. //   When the user clicks the right mouse button on an item within the shell's
  213. //  name space (i.g., file, directory, server, work-group, etc.), it creates
  214. //  the default context menu for its type, then loads context menu extensions
  215. //  that are registered for that type (and its base type) so that they can
  216. //  add extra menu items. Those context menu extensions are registered at
  217. //  HKCR\{ProgID}\shellex\ContextMenuHandlers.
  218. //
  219. // case-2: The shell is retrieving a context menu of sub-folders in extended
  220. //   name-space.
  221. //
  222. //   When the explorer's name space is extended by name space extensions,
  223. //  the shell calls their IShellFolder::GetUIObjectOf to get the IContextMenu
  224. //  objects when it creates context menus for folders under those extended
  225. //  name spaces.
  226. //
  227. // case-3: The shell is loading non-default drag and drop handler for directories.
  228. //
  229. //   When the user performed a non-default drag and drop onto one of file
  230. //  system folders (i.e., directories), it loads shell extensions that are
  231. //  registered at HKCR\{ProgID}\DragDropHandlers.
  232. //
  233. //
  234. // [Member functions]
  235. //
  236. //
  237. // IContextMenu::QueryContextMenu
  238. //
  239. //   This member function may insert one or more menuitems to the specified
  240. //  menu (hmenu) at the specified location (indexMenu which is never be -1).
  241. //  The IDs of those menuitem must be in the specified range (idCmdFirst and
  242. //  idCmdLast). It returns the maximum menuitem ID offset (ushort) in the
  243. //  'code' field (low word) of the scode.
  244. //
  245. //   The uFlags specify the context. It may have one or more of following
  246. //  flags.
  247. //
  248. //  CMF_DEFAULTONLY: This flag is passed if the user is invoking the default
  249. //   action (typically by double-clicking, case 1 and 2 only). Context menu
  250. //   extensions (case 1) should not add any menu items, and returns NOERROR.
  251. //
  252. //  CMF_VERBSONLY: The explorer passes this flag if it is constructing
  253. //   a context menu for a short-cut object (case 1 and case 2 only). If this
  254. //   flag is passed, it should not add any menu-items that is not appropriate
  255. //   from a short-cut.
  256. //    A good example is the "Delete" menuitem, which confuses the user
  257. //   because it is not clear whether it deletes the link source item or the
  258. //   link itself.
  259. //
  260. //  CMF_EXPLORER: The explorer passes this flag if it has the left-side pane
  261. //   (case 1 and 2 only). Context menu extensions should ignore this flag.
  262. //
  263. //   High word (16-bit) are reserved for context specific communications
  264. //  and the rest of flags (13-bit) are reserved by the system.
  265. //
  266. //
  267. // IContextMenu::InvokeCommand
  268. //
  269. //   This member is called when the user has selected one of menuitems that
  270. //  are inserted by previous QueryContextMenu member. In this case, the
  271. //  LOWORD(lpici->lpVerb) contains the menuitem ID offset (menuitem ID -
  272. //  idCmdFirst).
  273. //
  274. //   This member function may also be called programmatically. In such a case,
  275. //  lpici->lpVerb specifies the canonical name of the command to be invoked,
  276. //  which is typically retrieved by GetCommandString member previously.
  277. //
  278. //  Parameters in lpci:
  279. //    cbSize -- Specifies the size of this structure (sizeof(*lpci))
  280. //    hwnd   -- Specifies the owner window for any message/dialog box.
  281. //    fMask  -- Specifies whether or not dwHotkey/hIcon paramter is valid.
  282. //    lpVerb -- Specifies the command to be invoked.
  283. //    lpParameters -- Parameters (optional)
  284. //    lpDirectory  -- Working directory (optional)
  285. //    nShow -- Specifies the flag to be passed to ShowWindow (SW_*).
  286. //    dwHotKey -- Hot key to be assigned to the app after invoked (optional).
  287. //    hIcon -- Specifies the icon (optional).
  288. //    hMonitor -- Specifies the default monitor (optional).
  289. //
  290. //
  291. // IContextMenu::GetCommandString
  292. //
  293. //   This member function is called by the explorer either to get the
  294. //  canonical (language independent) command name (uFlags == GCS_VERB) or
  295. //  the help text ((uFlags & GCS_HELPTEXT) != 0) for the specified command.
  296. //  The retrieved canonical string may be passed to its InvokeCommand
  297. //  member function to invoke a command programmatically. The explorer
  298. //  displays the help texts in its status bar; therefore, the length of
  299. //  the help text should be reasonably short (<40 characters).
  300. //
  301. //  Parameters:
  302. //   idCmd -- Specifies menuitem ID offset (from idCmdFirst)
  303. //   uFlags -- Either GCS_VERB or GCS_HELPTEXT
  304. //   pwReserved -- Reserved (must pass NULL when calling, must ignore when called)
  305. //   pszName -- Specifies the string buffer.
  306. //   cchMax -- Specifies the size of the string buffer.
  307. //
  308. //===========================================================================
  309.  
  310. // QueryContextMenu uFlags
  311. #define CMF_NORMAL              0x00000000
  312. #define CMF_DEFAULTONLY         0x00000001
  313. #define CMF_VERBSONLY           0x00000002
  314. #define CMF_EXPLORE             0x00000004
  315. #define CMF_NOVERBS             0x00000008
  316. #define CMF_CANRENAME           0x00000010
  317. #define CMF_NODEFAULT           0x00000020
  318. #define CMF_INCLUDESTATIC       0x00000040
  319. #define CMF_FINDHACK            0x00000080
  320. #define CMF_EXTENDEDVERBS       0x00000100      // rarely used verbs
  321. #define CMF_RESERVED            0xffff0000      // View specific
  322.  
  323. // GetCommandString uFlags
  324. #define GCS_VERBA        0x00000000     // canonical verb
  325. #define GCS_HELPTEXTA    0x00000001     // help text (for status bar)
  326. #define GCS_VALIDATEA    0x00000002     // validate command exists
  327. #define GCS_VERBW        0x00000004     // canonical verb (unicode)
  328. #define GCS_HELPTEXTW    0x00000005     // help text (unicode version)
  329. #define GCS_VALIDATEW    0x00000006     // validate command exists (unicode)
  330. #define GCS_UNICODE      0x00000004     // for bit testing - Unicode string
  331.  
  332. #ifdef UNICODE
  333. #define GCS_VERB        GCS_VERBW
  334. #define GCS_HELPTEXT    GCS_HELPTEXTW
  335. #define GCS_VALIDATE    GCS_VALIDATEW
  336. #else
  337. #define GCS_VERB        GCS_VERBA
  338. #define GCS_HELPTEXT    GCS_HELPTEXTA
  339. #define GCS_VALIDATE    GCS_VALIDATEA
  340. #endif
  341.  
  342. #define CMDSTR_NEWFOLDERA   "NewFolder"
  343. #define CMDSTR_VIEWLISTA    "ViewList"
  344. #define CMDSTR_VIEWDETAILSA "ViewDetails"
  345. #define CMDSTR_NEWFOLDERW   L"NewFolder"
  346. #define CMDSTR_VIEWLISTW    L"ViewList"
  347. #define CMDSTR_VIEWDETAILSW L"ViewDetails"
  348.  
  349. #ifdef UNICODE
  350. #define CMDSTR_NEWFOLDER    CMDSTR_NEWFOLDERW
  351. #define CMDSTR_VIEWLIST     CMDSTR_VIEWLISTW
  352. #define CMDSTR_VIEWDETAILS  CMDSTR_VIEWDETAILSW
  353. #else
  354. #define CMDSTR_NEWFOLDER    CMDSTR_NEWFOLDERA
  355. #define CMDSTR_VIEWLIST     CMDSTR_VIEWLISTA
  356. #define CMDSTR_VIEWDETAILS  CMDSTR_VIEWDETAILSA
  357. #endif
  358.  
  359. #define CMIC_MASK_HOTKEY        SEE_MASK_HOTKEY
  360. #define CMIC_MASK_ICON          SEE_MASK_ICON
  361. #define CMIC_MASK_FLAG_NO_UI    SEE_MASK_FLAG_NO_UI
  362. #define CMIC_MASK_UNICODE       SEE_MASK_UNICODE
  363. #define CMIC_MASK_NO_CONSOLE    SEE_MASK_NO_CONSOLE
  364. #define CMIC_MASK_HASLINKNAME   SEE_MASK_HASLINKNAME
  365. #define CMIC_MASK_FLAG_SEP_VDM  SEE_MASK_FLAG_SEPVDM
  366. #define CMIC_MASK_HASTITLE      SEE_MASK_HASTITLE
  367. #define CMIC_MASK_ASYNCOK       SEE_MASK_ASYNCOK
  368. #if (_WIN32_IE >= 0x0501)
  369. #define CMIC_MASK_SHIFT_DOWN    0x10000000
  370. #define CMIC_MASK_CONTROL_DOWN  0x20000000
  371. #endif // (_WIN32_IE >= 0x501)
  372.  
  373.  
  374. #if (_WIN32_IE >= 0x0400)
  375. #define CMIC_MASK_PTINVOKE      0x20000000
  376. #endif
  377.  
  378.  
  379. //NOTE: When SEE_MASK_HMONITOR is set, hIcon is treated as hMonitor
  380. typedef struct _CMINVOKECOMMANDINFO {
  381.     DWORD cbSize;        // sizeof(CMINVOKECOMMANDINFO)
  382.     DWORD fMask;         // any combination of CMIC_MASK_*
  383.     HWND hwnd;           // might be NULL (indicating no owner window)
  384.     LPCSTR lpVerb;       // either a string or MAKEINTRESOURCE(idOffset)
  385.     LPCSTR lpParameters; // might be NULL (indicating no parameter)
  386.     LPCSTR lpDirectory;  // might be NULL (indicating no specific directory)
  387.     int nShow;           // one of SW_ values for ShowWindow() API
  388.  
  389.     DWORD dwHotKey;
  390.     HANDLE hIcon;
  391. } CMINVOKECOMMANDINFO,  *LPCMINVOKECOMMANDINFO;
  392.  
  393. typedef struct _CMInvokeCommandInfoEx {
  394.     DWORD cbSize;        // must be sizeof(CMINVOKECOMMANDINFOEX)
  395.     DWORD fMask;         // any combination of CMIC_MASK_*
  396.     HWND hwnd;           // might be NULL (indicating no owner window)
  397.     LPCSTR lpVerb;       // either a string or MAKEINTRESOURCE(idOffset)
  398.     LPCSTR lpParameters; // might be NULL (indicating no parameter)
  399.     LPCSTR lpDirectory;  // might be NULL (indicating no specific directory)
  400.     int nShow;           // one of SW_ values for ShowWindow() API
  401.  
  402.     DWORD dwHotKey;
  403.  
  404.     HANDLE hIcon;
  405.     LPCSTR lpTitle;      // For CreateProcess-StartupInfo.lpTitle
  406.     LPCWSTR lpVerbW;        // Unicode verb (for those who can use it)
  407.     LPCWSTR lpParametersW;  // Unicode parameters (for those who can use it)
  408.     LPCWSTR lpDirectoryW;   // Unicode directory (for those who can use it)
  409.     LPCWSTR lpTitleW;       // Unicode title (for those who can use it)
  410. #if (_WIN32_IE >= 0x0400)
  411.     POINT   ptInvoke;       // Point where it's invoked
  412. #endif
  413. } CMINVOKECOMMANDINFOEX,  *LPCMINVOKECOMMANDINFOEX;
  414.  
  415. #undef  INTERFACE
  416. #define INTERFACE   IContextMenu
  417.  
  418. DECLARE_INTERFACE_(IContextMenu, IUnknown)
  419. {
  420.     // *** IUnknown methods ***
  421.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
  422.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  423.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  424.  
  425.     STDMETHOD(QueryContextMenu)(THIS_
  426.                                 HMENU hmenu,
  427.                                 UINT indexMenu,
  428.                                 UINT idCmdFirst,
  429.                                 UINT idCmdLast,
  430.                                 UINT uFlags) PURE;
  431.  
  432.     STDMETHOD(InvokeCommand)(THIS_
  433.                              LPCMINVOKECOMMANDINFO lpici) PURE;
  434.  
  435.     STDMETHOD(GetCommandString)(THIS_
  436.                                 UINT_PTR    idCmd,
  437.                                 UINT        uType,
  438.                                 UINT      * pwReserved,
  439.                                 LPSTR       pszName,
  440.                                 UINT        cchMax) PURE;
  441. };
  442.  
  443. typedef IContextMenu *  LPCONTEXTMENU;
  444.  
  445. //
  446. // IContextMenu2 (IContextMenu with one new member)
  447. //
  448. // IContextMenu2::HandleMenuMsg
  449. //
  450. //  This function is called, if the client of IContextMenu is aware of
  451. // IContextMenu2 interface and receives one of following messages while
  452. // it is calling TrackPopupMenu (in the window proc of hwnd):
  453. //      WM_INITPOPUP, WM_DRAWITEM and WM_MEASUREITEM
  454. //  The callee may handle these messages to draw owner draw menuitems.
  455. //
  456.  
  457. #undef  INTERFACE
  458. #define INTERFACE   IContextMenu2
  459.  
  460. DECLARE_INTERFACE_(IContextMenu2, IContextMenu)
  461. {
  462.     // *** IUnknown methods ***
  463.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
  464.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  465.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  466.  
  467.     // *** IContextMenu methods ***
  468.  
  469.     STDMETHOD(QueryContextMenu)(THIS_
  470.                                 HMENU hmenu,
  471.                                 UINT indexMenu,
  472.                                 UINT idCmdFirst,
  473.                                 UINT idCmdLast,
  474.                                 UINT uFlags) PURE;
  475.  
  476.     STDMETHOD(InvokeCommand)(THIS_
  477.                              LPCMINVOKECOMMANDINFO lpici) PURE;
  478.  
  479.     STDMETHOD(GetCommandString)(THIS_
  480.                                 UINT_PTR    idCmd,
  481.                                 UINT        uType,
  482.                                 UINT      * pwReserved,
  483.                                 LPSTR       pszName,
  484.                                 UINT        cchMax) PURE;
  485.  
  486.     // *** IContextMenu2 methods ***
  487.  
  488.     STDMETHOD(HandleMenuMsg)(THIS_
  489.                              UINT uMsg,
  490.                              WPARAM wParam,
  491.                              LPARAM lParam) PURE;
  492. };
  493.  
  494. typedef IContextMenu2 * LPCONTEXTMENU2;
  495.  
  496. //
  497. // IContextMenu3 (IContextMenu with one new member)
  498. //
  499. // IContextMenu3::HandleMenuMsg2
  500. //
  501. //  This function is called, if the client of IContextMenu is aware of
  502. // IContextMenu3 interface and receives a menu message while
  503. // it is calling TrackPopupMenu (in the window proc of hwnd):
  504. //
  505.  
  506. #undef  INTERFACE
  507. #define INTERFACE   IContextMenu3
  508.  
  509. DECLARE_INTERFACE_(IContextMenu3, IContextMenu2)
  510. {
  511.     // *** IUnknown methods ***
  512.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
  513.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  514.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  515.  
  516.     // *** IContextMenu methods ***
  517.  
  518.     STDMETHOD(QueryContextMenu)(THIS_
  519.                                 HMENU hmenu,
  520.                                 UINT indexMenu,
  521.                                 UINT idCmdFirst,
  522.                                 UINT idCmdLast,
  523.                                 UINT uFlags) PURE;
  524.  
  525.     STDMETHOD(InvokeCommand)(THIS_
  526.                              LPCMINVOKECOMMANDINFO lpici) PURE;
  527.  
  528.     STDMETHOD(GetCommandString)(THIS_
  529.                                 UINT_PTR    idCmd,
  530.                                 UINT        uType,
  531.                                 UINT      * pwReserved,
  532.                                 LPSTR       pszName,
  533.                                 UINT        cchMax) PURE;
  534.  
  535.     // *** IContextMenu2 methods ***
  536.  
  537.     STDMETHOD(HandleMenuMsg)(THIS_
  538.                              UINT uMsg,
  539.                              WPARAM wParam,
  540.                              LPARAM lParam) PURE;
  541.  
  542.     // *** IContextMenu3 methods ***
  543.  
  544.     STDMETHOD(HandleMenuMsg2)(THIS_
  545.                              UINT uMsg,
  546.                              WPARAM wParam,
  547.                              LPARAM lParam,
  548.                              LRESULT* plResult) PURE;
  549. };
  550.  
  551. typedef IContextMenu3 * LPCONTEXTMENU3;
  552.  
  553.  
  554. //===========================================================================
  555. //
  556. // Interface: IShellExtInit
  557. //
  558. //  The IShellExtInit interface is used by the explorer to initialize shell
  559. // extension objects. The explorer (1) calls CoCreateInstance (or equivalent)
  560. // with the registered CLSID and IID_IShellExtInit, (2) calls its Initialize
  561. // member, then (3) calls its QueryInterface to a particular interface (such
  562. // as IContextMenu or IPropSheetExt and (4) performs the rest of operation.
  563. //
  564. //
  565. // [Member functions]
  566. //
  567. // IShellExtInit::Initialize
  568. //
  569. //  This member function is called when the explorer is initializing either
  570. // context menu extension, property sheet extension or non-default drag-drop
  571. // extension.
  572. //
  573. //  Parameters: (context menu or property sheet extension)
  574. //   pidlFolder -- Specifies the parent folder
  575. //   lpdobj -- Spefifies the set of items selected in that folder.
  576. //   hkeyProgID -- Specifies the type of the focused item in the selection.
  577. //
  578. //  Parameters: (non-default drag-and-drop extension)
  579. //   pidlFolder -- Specifies the target (destination) folder
  580. //   lpdobj -- Specifies the items that are dropped (see the description
  581. //    about shell's clipboard below for clipboard formats).
  582. //   hkeyProgID -- Specifies the folder type.
  583. //
  584. //===========================================================================
  585.  
  586. #undef  INTERFACE
  587. #define INTERFACE   IShellExtInit
  588.  
  589. DECLARE_INTERFACE_(IShellExtInit, IUnknown)
  590. {
  591.     // *** IUnknown methods ***
  592.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
  593.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  594.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  595.  
  596.     // *** IShellExtInit methods ***
  597.     STDMETHOD(Initialize)(THIS_ LPCITEMIDLIST pidlFolder,
  598.                           IDataObject *lpdobj, HKEY hkeyProgID) PURE;
  599. };
  600.  
  601. typedef IShellExtInit * LPSHELLEXTINIT;
  602.  
  603.  
  604. //===========================================================================
  605. //
  606. // Interface: IShellPropSheetExt
  607. //
  608. //  The explorer uses the IShellPropSheetExt to allow property sheet
  609. // extensions or control panel extensions to add additional property
  610. // sheet pages.
  611. //
  612. //
  613. // [Member functions]
  614. //
  615. // IShellPropSheetExt::AddPages
  616. //
  617. //  The explorer calls this member function when it finds a registered
  618. // property sheet extension for a particular type of object. For each
  619. // additional page, the extension creates a page object by calling
  620. // CreatePropertySheetPage API and calls lpfnAddPage.
  621. //
  622. //  Parameters:
  623. //   lpfnAddPage -- Specifies the callback function.
  624. //   lParam -- Specifies the opaque handle to be passed to the callback function.
  625. //
  626. //
  627. // IShellPropSheetExt::ReplacePage
  628. //
  629. //  The explorer never calls this member of property sheet extensions. The
  630. // explorer calls this member of control panel extensions, so that they
  631. // can replace some of default control panel pages (such as a page of
  632. // mouse control panel).
  633. //
  634. //  Parameters:
  635. //   uPageID -- Specifies the page to be replaced.
  636. //   lpfnReplace Specifies the callback function.
  637. //   lParam -- Specifies the opaque handle to be passed to the callback function.
  638. //
  639. //===========================================================================
  640.  
  641. #undef  INTERFACE
  642. #define INTERFACE   IShellPropSheetExt
  643.  
  644. DECLARE_INTERFACE_(IShellPropSheetExt, IUnknown)
  645. {
  646.     // *** IUnknown methods ***
  647.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
  648.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  649.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  650.  
  651.     // *** IShellPropSheetExt methods ***
  652.     STDMETHOD(AddPages)(THIS_ LPFNADDPROPSHEETPAGE lpfnAddPage, LPARAM lParam) PURE;
  653.     STDMETHOD(ReplacePage)(THIS_ UINT uPageID, LPFNADDPROPSHEETPAGE lpfnReplaceWith, LPARAM lParam) PURE;
  654. };
  655.  
  656. typedef IShellPropSheetExt * LPSHELLPROPSHEETEXT;
  657.  
  658.  
  659. //===========================================================================
  660. //
  661. // IPersistFolder Interface
  662. //
  663. //  The IPersistFolder interface is used by the file system implementation of
  664. // IShellFolder::BindToObject when it is initializing a shell folder object.
  665. //
  666. //
  667. // [Member functions]
  668. //
  669. // IPersistFolder::Initialize
  670. //
  671. //  This member function is called when the explorer is initializing a
  672. // shell folder object.
  673. //
  674. //  Parameters:
  675. //   pidl -- Specifies the absolute location of the folder.
  676. //
  677. //===========================================================================
  678.  
  679. #undef  INTERFACE
  680. #define INTERFACE   IPersistFolder
  681.  
  682. DECLARE_INTERFACE_(IPersistFolder, IPersist)    // fld
  683. {
  684.     // *** IUnknown methods ***
  685.     STDMETHOD(QueryInterface)(THIS_ REFIID riid, void **ppv) PURE;
  686.     STDMETHOD_(ULONG,AddRef)(THIS)  PURE;
  687.     STDMETHOD_(ULONG,Release)(THIS) PURE;
  688.  
  689.     // *** IPersist methods ***
  690.     STDMETHOD(GetClassID)(THIS_ LPCLSID lpClassID) PURE;
  691.  
  692.     // *** IPersistFolder methods ***
  693.     STDMETHOD(Initialize)(THIS_ LPCITEMIDLIST pidl) PURE;
  694. };
  695.  
  696. typedef IPersistFolder *LPPERSISTFOLDER;
  697.  
  698. #if (_WIN32_IE >= 0x0400)
  699.  
  700. #undef  INTERFACE
  701. #define INTERFACE   IPersistFolder2
  702.  
  703. DECLARE_INTERFACE_(IPersistFolder2, IPersistFolder)
  704. {
  705.     // *** IUnknown methods ***
  706.     STDMETHOD(QueryInterface)(THIS_ REFIID riid, void **ppv) PURE;
  707.     STDMETHOD_(ULONG,AddRef)(THIS)  PURE;
  708.     STDMETHOD_(ULONG,Release)(THIS) PURE;
  709.  
  710.     // *** IPersist methods ***
  711.     STDMETHOD(GetClassID)(THIS_ LPCLSID lpClassID) PURE;
  712.  
  713.     // *** IPersistFolder methods ***
  714.     STDMETHOD(Initialize)(THIS_ LPCITEMIDLIST pidl) PURE;
  715.  
  716.     // *** IPersistFolder2 methods ***
  717.     STDMETHOD(GetCurFolder)(THIS_ LPITEMIDLIST *ppidl) PURE;
  718. };
  719.  
  720. #if (_WIN32_IE >= 0x0401)
  721. typedef IPersistFolder2 *LPPERSISTFOLDER2;
  722. #endif
  723.  
  724. #endif
  725.  
  726. #if (_WIN32_IE >= 0x0500)
  727. #undef  INTERFACE
  728. #define INTERFACE   IPersistFolder3
  729.  
  730. #define CSIDL_FLAG_PFTI_TRACKTARGET CSIDL_FLAG_DONT_VERIFY
  731.  
  732. // DESCRIPTION: PERSIST_FOLDER_TARGET_INFO
  733. //    This stucture is used for Folder Shortcuts which allow the shell to
  734. // have a file system folder act like another area in the name space.
  735. // One of pidlTargetFolder, szTargetParsingName, or csidl needs to
  736. // specify the destination name space.
  737. //
  738. // pidlTargetFolder: This is a full pidl to the target folder.  Can be NULL in the IPersistFolder3::InitializeEx()
  739. //                   call but not in the GetFolderTargetInfo() return structure.
  740. // szTargetParsingName: Empty string if not specified. Ortherwise, it is the parsible name
  741. //                       to the target.  This name can be parsed by IShellFolder::
  742. //                       ParseDisplayName() from the desktop.
  743. // szNetworkProvider: Can be an empty string.  If not empty, it specifies the type of network
  744. //                    provider that will be used when binding to the target.  This is used
  745. //                    for performance optimizations for the WNet APIs.
  746. // dwAttributes: -1 if not known.  These are the SFGAO_ flags for IShellFolder::GetAttributesOf()
  747. // csidl: This is -1 if it's not used.  This can be used instead of pidlTargetFolder or
  748. //        szTargetParsingName to indicate the TargetFolder.  See the list of CSIDL_ folders
  749. //        below.  CSIDL_FLAG_PFTI_TRACKTARGET means that the IShellFolder's target folder
  750. //        should change if the user changes the target of the underlying CSIDL value.
  751. //        You can also pass CSIDL_FLAG_CREATE to indicate that the target folder
  752. //        should be created if it does not exist.  No other CSIDL_FLAG_* values are supported.
  753. typedef struct
  754. {
  755.     LPITEMIDLIST  pidlTargetFolder;               // pidl for the folder we want to intiailize
  756.     WCHAR         szTargetParsingName[MAX_PATH];  // optional parsing name for the target
  757.     WCHAR         szNetworkProvider[MAX_PATH];    // optional network provider
  758.     DWORD         dwAttributes;                   // optional FILE_ATTRIBUTES_ flags (-1 if not used)
  759.     int           csidl;                          // optional folder index (SHGetFolderPath()) -1 if not used
  760. } PERSIST_FOLDER_TARGET_INFO;
  761.  
  762.  
  763. // DESCRIPTION: IPersistFolder3
  764. //    This interface is implemented by an IShellFolder object that wants non-default
  765. // handling of Folder Shortcuts.  In general, shell name space extensions should use
  766. // pidlRoot (the alias pidl) as their location in the name space and pass it to public
  767. // APIs, such as ShellExecute().  The one exception is that pidlTarget should be used
  768. // when sending ChangeNotifies or registering to listen for change notifies
  769. // (see SFVM_GETNOTIFY).
  770. //
  771. // InitializeEx: This method initializes an IShellFolder and specifies where
  772. //               it is rooted in the name space.
  773. //      pbc: May be NULL.
  774. //      pidlRoot: This is the same parameter as IPersistFolder::Initialize(). Caller allocates
  775. //                and frees this parameter.
  776. //      ppfti: May be NULL, in which case this is the same as a call to IPersistFolder::Initialize().
  777. //             Otherwise this is a Folder Shortcut and this struction specifies the target
  778. //             folder and it's attributes.
  779. // GetFolderTargetInfo: This is used by the caller to find information about
  780. //             the folder shortcut.  This structure may not be initialized by the caller,
  781. //             so the callee needs to initialize every member.  The callee allocates
  782. //             pidlTargetFolder and the caller will free it.  Filling in pidlTargetFolder is
  783. //             ALWAYS required.
  784.  
  785. DECLARE_INTERFACE_(IPersistFolder3, IPersistFolder2)
  786. {
  787.     // *** IUnknown methods ***
  788.     STDMETHOD(QueryInterface)(THIS_ REFIID riid, void **ppv) PURE;
  789.     STDMETHOD_(ULONG,AddRef)(THIS)  PURE;
  790.     STDMETHOD_(ULONG,Release)(THIS) PURE;
  791.  
  792.     // *** IPersist methods ***
  793.     STDMETHOD(GetClassID)(THIS_ LPCLSID lpClassID) PURE;
  794.  
  795.     // *** IPersistFolder methods ***
  796.     STDMETHOD(Initialize)(THIS_ LPCITEMIDLIST pidl) PURE;
  797.  
  798.     // *** IPersistFolder2 methods ***
  799.     STDMETHOD(GetCurFolder)(THIS_ LPITEMIDLIST *ppidl) PURE;
  800.  
  801.     // *** IPersistFolder3 methods ***
  802.     STDMETHOD(InitializeEx)(THIS_ IBindCtx *pbc, LPCITEMIDLIST pidlRoot, const PERSIST_FOLDER_TARGET_INFO *ppfti) PURE;
  803.     STDMETHOD(GetFolderTargetInfo)(THIS_ PERSIST_FOLDER_TARGET_INFO *ppfti) PURE;
  804. };
  805.  
  806. //
  807. //  this interface is just the IID.  return back
  808. //  a pointer to the IPersist interface if the object
  809. //  implementation is free threaded.  this is used
  810. //  for performance on free threaded objects.
  811. //
  812. #define IPersistFreeThreadedObject IPersist
  813.  
  814. #endif
  815.  
  816. //
  817.  
  818. //===========================================================================
  819. //
  820. // IRemoteComputer Interface
  821. //
  822. //  The IRemoteComputer interface is used to initialize a name space
  823. // extension invoked on a remote computer object.
  824. //
  825. // [Member functions]
  826. //
  827. // IRemoteComputer::Initialize
  828. //
  829. //  This member function is called when the explorer is initializing or
  830. // enumerating the name space extension. If failure is returned during
  831. // enumeration, the extension won't appear for this computer. Otherwise,
  832. // the extension will appear, and should target the given machine.
  833. //
  834. //  Parameters:
  835. //   pszMachine -- Specifies the name of the machine to target.
  836. //
  837. //===========================================================================
  838.  
  839. #undef  INTERFACE
  840. #define INTERFACE   IRemoteComputer
  841.  
  842. DECLARE_INTERFACE_(IRemoteComputer, IUnknown)    // remc
  843. {
  844.     // *** IUnknown methods ***
  845.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
  846.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  847.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  848.  
  849.     // *** IRemoteComputer methods ***
  850.     STDMETHOD(Initialize) (THIS_ const WCHAR *pszMachine, BOOL bEnumerating) PURE;
  851. };
  852.  
  853. //===========================================================================
  854. //
  855. // IExtractIcon interface
  856. //
  857. //  This interface is used in two different places in the shell.
  858. //
  859. // Case-1: Icons of sub-folders for the scope-pane of the explorer.
  860. //
  861. //  It is used by the explorer to get the "icon location" of
  862. // sub-folders from each shell folders. When the user expands a folder
  863. // in the scope pane of the explorer, the explorer does following:
  864. //  (1) binds to the folder (gets IShellFolder),
  865. //  (2) enumerates its sub-folders by calling its EnumObjects member,
  866. //  (3) calls its GetUIObjectOf member to get IExtractIcon interface
  867. //     for each sub-folders.
  868. //  In this case, the explorer uses only IExtractIcon::GetIconLocation
  869. // member to get the location of the appropriate icon. An icon location
  870. // always consists of a file name (typically DLL or EXE) and either an icon
  871. // resource or an icon index.
  872. //
  873. //
  874. // Case-2: Extracting an icon image from a file
  875. //
  876. //  It is used by the shell when it extracts an icon image
  877. // from a file. When the shell is extracting an icon from a file,
  878. // it does following:
  879. //  (1) creates the icon extraction handler object (by getting its CLSID
  880. //     under the {ProgID}\shell\ExtractIconHanler key and calling
  881. //     CoCreateInstance requesting for IExtractIcon interface).
  882. //  (2) Calls IExtractIcon::GetIconLocation.
  883. //  (3) Then, calls IExtractIcon::ExtractIcon with the location/index pair.
  884. //  (4) If (3) returns NOERROR, it uses the returned icon.
  885. //  (5) Otherwise, it recursively calls this logic with new location
  886. //     assuming that the location string contains a fully qualified path name.
  887. //
  888. //  From extension programmer's point of view, there are only two cases
  889. // where they provide implementations of IExtractIcon:
  890. //  Case-1) providing explorer extensions (i.e., IShellFolder).
  891. //  Case-2) providing per-instance icons for some types of files.
  892. //
  893. // Because Case-1 is described above, we'll explain only Case-2 here.
  894. //
  895. // When the shell is about display an icon for a file, it does following:
  896. //  (1) Finds its ProgID and ClassID.
  897. //  (2) If the file has a ClassID, it gets the icon location string from the
  898. //    "DefaultIcon" key under it. The string indicates either per-class
  899. //    icon (e.g., "FOOBAR.DLL,2") or per-instance icon (e.g., "%1,1").
  900. //  (3) If a per-instance icon is specified, the shell creates an icon
  901. //    extraction handler object for it, and extracts the icon from it
  902. //    (which is described above).
  903. //
  904. //  It is important to note that the shell calls IExtractIcon::GetIconLocation
  905. // first, then calls IExtractIcon::Extract. Most application programs
  906. // that support per-instance icons will probably store an icon location
  907. // (DLL/EXE name and index/id) rather than an icon image in each file.
  908. // In those cases, a programmer needs to implement only the GetIconLocation
  909. // member and it Extract member simply returns S_FALSE. They need to
  910. // implement Extract member only if they decided to store the icon images
  911. // within files themselved or some other database (which is very rare).
  912. //
  913. //
  914. //
  915. // [Member functions]
  916. //
  917. //
  918. // IExtractIcon::GetIconLocation
  919. //
  920. //  This function returns an icon location.
  921. //
  922. //  Parameters:
  923. //   uFlags     [in]  -- Specifies if it is opened or not (GIL_OPENICON or 0)
  924. //   szIconFile [out] -- Specifies the string buffer buffer for a location name.
  925. //   cchMax     [in]  -- Specifies the size of szIconFile (almost always MAX_PATH)
  926. //   piIndex    [out] -- Sepcifies the address of UINT for the index.
  927. //   pwFlags    [out] -- Returns GIL_* flags
  928. //  Returns:
  929. //   NOERROR, if it returns a valid location; S_FALSE, if the shell use a
  930. //   default icon.
  931. //
  932. //  Notes: The location may or may not be a path to a file. The caller can
  933. //   not assume anything unless the subsequent Extract member call returns
  934. //   S_FALSE.
  935. //
  936. //   if the returned location is not a path to a file, GIL_NOTFILENAME should
  937. //   be set in the returned flags.
  938. //
  939. // IExtractIcon::Extract
  940. //
  941. //  This function extracts an icon image from a specified file.
  942. //
  943. //  Parameters:
  944. //   pszFile [in] -- Specifies the icon location (typically a path to a file).
  945. //   nIconIndex [in] -- Specifies the icon index.
  946. //   phiconLarge [out] -- Specifies the HICON variable for large icon.
  947. //   phiconSmall [out] -- Specifies the HICON variable for small icon.
  948. //   nIconSize [in] -- Specifies the size icon required (size of large icon)
  949. //                     LOWORD is the requested large icon size
  950. //                     HIWORD is the requested small icon size
  951. //  Returns:
  952. //   NOERROR, if it extracted the from the file.
  953. //   S_FALSE, if the caller should extract from the file specified in the
  954. //           location.
  955. //
  956. //===========================================================================
  957.  
  958. // GetIconLocation() input flags
  959.  
  960. #define GIL_OPENICON     0x0001      // allows containers to specify an "open" look
  961. #define GIL_FORSHELL     0x0002      // icon is to be displayed in a ShellFolder
  962. #define GIL_ASYNC        0x0020      // this is an async extract, return E_ASYNC
  963.  
  964. // GetIconLocation() return flags
  965.  
  966. #define GIL_SIMULATEDOC  0x0001      // simulate this document icon for this
  967. #define GIL_PERINSTANCE  0x0002      // icons from this class are per instance (each file has its own)
  968. #define GIL_PERCLASS     0x0004      // icons from this class per class (shared for all files of this type)
  969. #define GIL_NOTFILENAME  0x0008      // location is not a filename, must call ::ExtractIcon
  970. #define GIL_DONTCACHE    0x0010      // this icon should not be cached
  971.  
  972. #undef  INTERFACE
  973. #define INTERFACE   IExtractIconA
  974.  
  975. DECLARE_INTERFACE_(IExtractIconA, IUnknown)     // exic
  976. {
  977.     // *** IUnknown methods ***
  978.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
  979.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  980.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  981.  
  982.     // *** IExtractIcon methods ***
  983.     STDMETHOD(GetIconLocation)(THIS_
  984.                          UINT   uFlags,
  985.                          LPSTR  szIconFile,
  986.                          UINT   cchMax,
  987.                          int   * piIndex,
  988.                          UINT  * pwFlags) PURE;
  989.  
  990.     STDMETHOD(Extract)(THIS_
  991.                            LPCSTR pszFile,
  992.                            UINT   nIconIndex,
  993.                            HICON   *phiconLarge,
  994.                            HICON   *phiconSmall,
  995.                            UINT    nIconSize) PURE;
  996. };
  997.  
  998. typedef IExtractIconA * LPEXTRACTICONA;
  999.  
  1000. #undef  INTERFACE
  1001. #define INTERFACE   IExtractIconW
  1002.  
  1003. DECLARE_INTERFACE_(IExtractIconW, IUnknown)     // exic
  1004. {
  1005.     // *** IUnknown methods ***
  1006.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
  1007.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  1008.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  1009.  
  1010.     // *** IExtractIcon methods ***
  1011.     STDMETHOD(GetIconLocation)(THIS_
  1012.                          UINT   uFlags,
  1013.                          LPWSTR szIconFile,
  1014.                          UINT   cchMax,
  1015.                          int   * piIndex,
  1016.                          UINT  * pwFlags) PURE;
  1017.  
  1018.     STDMETHOD(Extract)(THIS_
  1019.                            LPCWSTR pszFile,
  1020.                            UINT   nIconIndex,
  1021.                            HICON   *phiconLarge,
  1022.                            HICON   *phiconSmall,
  1023.                            UINT    nIconSize) PURE;
  1024. };
  1025.  
  1026. typedef IExtractIconW * LPEXTRACTICONW;
  1027.  
  1028. #ifdef UNICODE
  1029. #define IExtractIcon        IExtractIconW
  1030. #define IExtractIconVtbl    IExtractIconWVtbl
  1031. #define LPEXTRACTICON       LPEXTRACTICONW
  1032. #else
  1033. #define IExtractIcon        IExtractIconA
  1034. #define IExtractIconVtbl    IExtractIconAVtbl
  1035. #define LPEXTRACTICON       LPEXTRACTICONA
  1036. #endif
  1037.  
  1038. //===========================================================================
  1039. //
  1040. // IShellIcon Interface
  1041. //
  1042. // used to get a icon index for a IShellFolder object.
  1043. //
  1044. // this interface can be implemented by a IShellFolder, as a quick way to
  1045. // return the icon for a object in the folder.
  1046. //
  1047. // a instance of this interface is only created once for the folder, unlike
  1048. // IExtractIcon witch is created once for each object.
  1049. //
  1050. // if a ShellFolder does not implement this interface, the standard
  1051. // GetUIObject(....IExtractIcon) method will be used to get a icon
  1052. // for all objects.
  1053. //
  1054. // the following standard imagelist indexs can be returned:
  1055. //
  1056. //      0   document (blank page) (not associated)
  1057. //      1   document (with stuff on the page)
  1058. //      2   application (exe, com, bat)
  1059. //      3   folder (plain)
  1060. //      4   folder (open)
  1061. //
  1062. // IShellIcon:GetIconOf(pidl, flags, lpIconIndex)
  1063. //
  1064. //      pidl            object to get icon for.
  1065. //      flags           GIL_* input flags (GIL_OPEN, ...)
  1066. //      lpIconIndex     place to return icon index.
  1067. //
  1068. //  returns:
  1069. //      NOERROR, if lpIconIndex contains the correct system imagelist index.
  1070. //      S_FALSE, if unable to get icon for this object, go through
  1071. //               GetUIObject, IExtractIcon, methods.
  1072. //
  1073. //===========================================================================
  1074.  
  1075. #undef  INTERFACE
  1076. #define INTERFACE   IShellIcon
  1077.  
  1078. DECLARE_INTERFACE_(IShellIcon, IUnknown)      // shi
  1079. {
  1080.     // *** IUnknown methods ***
  1081.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
  1082.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  1083.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  1084.  
  1085.     // *** IShellIcon methods ***
  1086.     STDMETHOD(GetIconOf)(THIS_ LPCITEMIDLIST pidl, UINT flags,
  1087.                     LPINT lpIconIndex) PURE;
  1088. };
  1089.  
  1090. typedef IShellIcon *LPSHELLICON;
  1091.  
  1092. //===========================================================================
  1093. //
  1094. // IShellIconOverlayIdentifier
  1095. //
  1096. // Used to identify a file as a member of the group of files that have this specific
  1097. // icon overlay
  1098. //
  1099. // Users can create new IconOverlayIdentifiers and place them in the following registry
  1100. // location together with the Icon overlay image and their priority.
  1101. // HKEY_LOCAL_MACHINE "Software\\Microsoft\\Windows\\CurrentVersion\\ShellIconOverlayIdentifiers"
  1102. //
  1103. // The shell will enumerate through all IconOverlayIdentifiers at start, and prioritize
  1104. // them according to internal rules, in case the internal rules don't apply, we use their
  1105. // input priority
  1106. //
  1107. // IShellIconOverlayIdentifier:IsMemberOf(LPCWSTR pwszPath, DWORD dwAttrib)
  1108. //      pwszPath        full path of the file
  1109. //      dwAttrib        attribute of this file
  1110. //
  1111. //  returns:
  1112. //      S_OK,    if the file is a member
  1113. //      S_FALSE, if the file is not a member
  1114. //      E_FAIL,  if the operation failed due to bad WIN32_FIND_DATA
  1115. //
  1116. // IShellIconOverlayIdentifier::GetOverlayInfo(LPWSTR pwszIconFile, int * pIndex, DWORD * dwFlags) PURE;
  1117. //      pszIconFile    the path of the icon file
  1118. //      pIndex         Depend on the flags, this could contain the IconIndex
  1119. //      dwFlags        defined below
  1120. //
  1121. // IShellIconOverlayIdentifier::GetPriority(int * pIPriority) PURE;
  1122. //      pIPriority     the priority of this Overlay Identifier
  1123. //
  1124. //===========================================================================
  1125.  
  1126. #undef  INTERFACE
  1127. #define INTERFACE   IShellIconOverlayIdentifier
  1128.  
  1129. DECLARE_INTERFACE_(IShellIconOverlayIdentifier, IUnknown)
  1130. {
  1131.     // *** IUnknown methods ***
  1132.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
  1133.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  1134.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  1135.  
  1136.     // *** IShellIconOverlayIdentifier methods ***
  1137.     STDMETHOD (IsMemberOf)(THIS_ LPCWSTR pwszPath, DWORD dwAttrib) PURE;
  1138.     STDMETHOD (GetOverlayInfo)(THIS_ LPWSTR pwszIconFile, int cchMax, int * pIndex, DWORD * pdwFlags) PURE;
  1139.     STDMETHOD (GetPriority)(THIS_ int * pIPriority) PURE;
  1140. };
  1141.  
  1142. #define ISIOI_ICONFILE            0x00000001          // path is returned through pwszIconFile
  1143. #define ISIOI_ICONINDEX           0x00000002          // icon index in pwszIconFile is returned through pIndex
  1144.  
  1145.  
  1146. //===========================================================================
  1147. //
  1148. // IShellIconOverlay
  1149. //
  1150. // Used to return the icon overlay index or its icon index for an IShellFolder object,
  1151. // this is always implemented with IShellFolder
  1152. //
  1153. // IShellIconOverlay:GetOverlayIndex(LPCITEMIDLIST pidl, DWORD * pdwIndex)
  1154. //      pidl            object to identify icon overlay for.
  1155. //      pdwIndex        the Overlay Index in the system image list
  1156. //
  1157. // IShellIconOverlay:GetOverlayIconIndex(LPCITEMIDLIST pidl, DWORD * pdwIndex)
  1158. //      pdwIconIndex    the Overlay Icon index in the system image list
  1159. // This method is only used for those who are interested in seeing the real bits
  1160. // of the Overlay Icon
  1161. //
  1162. //  returns:
  1163. //      S_OK,  if the index of an Overlay is found
  1164. //      S_FALSE, if no Overlay exists for this file
  1165. //      E_FAIL, if pidl is bad
  1166. //
  1167. //===========================================================================
  1168.  
  1169. #undef  INTERFACE
  1170. #define INTERFACE   IShellIconOverlay
  1171.  
  1172. DECLARE_INTERFACE_(IShellIconOverlay, IUnknown)
  1173. {
  1174.     // *** IUnknown methods ***
  1175.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
  1176.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  1177.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  1178.  
  1179.     // *** IShellIconOverlay methods ***
  1180.     STDMETHOD(GetOverlayIndex)(THIS_ LPCITEMIDLIST pidl, int * pIndex) PURE;
  1181.     STDMETHOD(GetOverlayIconIndex)(THIS_ LPCITEMIDLIST pidl, int * pIconIndex) PURE;
  1182. };
  1183.  
  1184. #define OI_ASYNC 0xFFFFEEEE
  1185.  
  1186. //-------------------------------------------------------------------------
  1187. //
  1188. // SHGetIconOverlayIndex
  1189. //
  1190. // This function takes the path and icon/res id to the icon and convert it into
  1191. // an overlay index in the system image list.
  1192. // Note: there are totally only 15 slots for system image overlays, some of which
  1193. // was reserved by the system, or taken by the overlayidentifiers, so it's possible
  1194. // that this function would fail and return -1;
  1195. //
  1196. // To get the default overlays in the system, such as the share hand, link shortcut
  1197. // and slow files, pass NULL as the file name, then the IDO_SHGIOI_* flags as the icon index
  1198. //-------------------------------------------------------------------------
  1199.  
  1200. #define IDO_SHGIOI_SHARE  0x0FFFFFFF
  1201. #define IDO_SHGIOI_LINK   0x0FFFFFFE
  1202. #define IDO_SHGIOI_SLOWFILE 0x0FFFFFFFD
  1203. SHSTDAPI_(int) SHGetIconOverlayIndexA(LPCSTR pszIconPath, int iIconIndex);
  1204. SHSTDAPI_(int) SHGetIconOverlayIndexW(LPCWSTR pszIconPath, int iIconIndex);
  1205. #ifdef UNICODE
  1206. #define SHGetIconOverlayIndex  SHGetIconOverlayIndexW
  1207. #else
  1208. #define SHGetIconOverlayIndex  SHGetIconOverlayIndexA
  1209. #endif // !UNICODE
  1210.  
  1211.  
  1212. //===========================================================================
  1213. //
  1214. // IShellLink Interface
  1215. //
  1216. //===========================================================================
  1217.  
  1218. #ifdef UNICODE
  1219. #define IShellLink      IShellLinkW
  1220. #define IShellLinkVtbl  IShellLinkWVtbl
  1221. #else
  1222. #define IShellLink      IShellLinkA
  1223. #define IShellLinkVtbl  IShellLinkAVtbl
  1224. #endif
  1225.  
  1226. // IShellLink::Resolve fFlags
  1227. typedef enum {
  1228.     SLR_NO_UI           = 0x0001,   // don't post any UI durring the resolve operation
  1229.     SLR_ANY_MATCH       = 0x0002,   // no longer used
  1230.     SLR_UPDATE          = 0x0004,   // save the link back to it's file if the track made it dirty
  1231.     SLR_NOUPDATE        = 0x0008,
  1232.     SLR_NOSEARCH        = 0x0010,   // don't execute the search heuristics
  1233.     SLR_NOTRACK         = 0x0020,   // don't use NT5 object ID to track the link
  1234.     SLR_NOLINKINFO      = 0x0040,   // don't use the net and volume relative info
  1235.     SLR_INVOKE_MSI      = 0x0080,   // if we have a darwin link, then call msi to fault in the applicaion
  1236. } SLR_FLAGS;
  1237.  
  1238. // IShellLink::GetPath fFlags
  1239. typedef enum {
  1240.     SLGP_SHORTPATH      = 0x0001,
  1241.     SLGP_UNCPRIORITY    = 0x0002,
  1242.     SLGP_RAWPATH        = 0x0004,
  1243. } SLGP_FLAGS;
  1244.  
  1245. #undef  INTERFACE
  1246. #define INTERFACE   IShellLinkA
  1247.  
  1248. DECLARE_INTERFACE_(IShellLinkA, IUnknown)       // sl
  1249. {
  1250.     // *** IUnknown methods ***
  1251.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
  1252.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  1253.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  1254.  
  1255.     // *** IShellLink methods ***
  1256.     STDMETHOD(GetPath)(THIS_ LPSTR pszFile, int cchMaxPath, WIN32_FIND_DATAA *pfd, DWORD fFlags) PURE;
  1257.  
  1258.     STDMETHOD(GetIDList)(THIS_ LPITEMIDLIST * ppidl) PURE;
  1259.     STDMETHOD(SetIDList)(THIS_ LPCITEMIDLIST pidl) PURE;
  1260.  
  1261.     STDMETHOD(GetDescription)(THIS_ LPSTR pszName, int cchMaxName) PURE;
  1262.     STDMETHOD(SetDescription)(THIS_ LPCSTR pszName) PURE;
  1263.  
  1264.     STDMETHOD(GetWorkingDirectory)(THIS_ LPSTR pszDir, int cchMaxPath) PURE;
  1265.     STDMETHOD(SetWorkingDirectory)(THIS_ LPCSTR pszDir) PURE;
  1266.  
  1267.     STDMETHOD(GetArguments)(THIS_ LPSTR pszArgs, int cchMaxPath) PURE;
  1268.     STDMETHOD(SetArguments)(THIS_ LPCSTR pszArgs) PURE;
  1269.  
  1270.     STDMETHOD(GetHotkey)(THIS_ WORD *pwHotkey) PURE;
  1271.     STDMETHOD(SetHotkey)(THIS_ WORD wHotkey) PURE;
  1272.  
  1273.     STDMETHOD(GetShowCmd)(THIS_ int *piShowCmd) PURE;
  1274.     STDMETHOD(SetShowCmd)(THIS_ int iShowCmd) PURE;
  1275.  
  1276.     STDMETHOD(GetIconLocation)(THIS_ LPSTR pszIconPath, int cchIconPath, int *piIcon) PURE;
  1277.     STDMETHOD(SetIconLocation)(THIS_ LPCSTR pszIconPath, int iIcon) PURE;
  1278.  
  1279.     STDMETHOD(SetRelativePath)(THIS_ LPCSTR pszPathRel, DWORD dwReserved) PURE;
  1280.  
  1281.     STDMETHOD(Resolve)(THIS_ HWND hwnd, DWORD fFlags) PURE;
  1282.  
  1283.     STDMETHOD(SetPath)(THIS_ LPCSTR pszFile) PURE;
  1284. };
  1285.  
  1286. #undef  INTERFACE
  1287. #define INTERFACE   IShellLinkW
  1288.  
  1289. DECLARE_INTERFACE_(IShellLinkW, IUnknown)       // sl
  1290. {
  1291.     // *** IUnknown methods ***
  1292.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
  1293.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  1294.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  1295.  
  1296.     // *** IShellLink methods ***
  1297.     STDMETHOD(GetPath)(THIS_ LPWSTR pszFile, int cchMaxPath, WIN32_FIND_DATAW *pfd, DWORD fFlags) PURE;
  1298.  
  1299.     STDMETHOD(GetIDList)(THIS_ LPITEMIDLIST * ppidl) PURE;
  1300.     STDMETHOD(SetIDList)(THIS_ LPCITEMIDLIST pidl) PURE;
  1301.  
  1302.     STDMETHOD(GetDescription)(THIS_ LPWSTR pszName, int cchMaxName) PURE;
  1303.     STDMETHOD(SetDescription)(THIS_ LPCWSTR pszName) PURE;
  1304.  
  1305.     STDMETHOD(GetWorkingDirectory)(THIS_ LPWSTR pszDir, int cchMaxPath) PURE;
  1306.     STDMETHOD(SetWorkingDirectory)(THIS_ LPCWSTR pszDir) PURE;
  1307.  
  1308.     STDMETHOD(GetArguments)(THIS_ LPWSTR pszArgs, int cchMaxPath) PURE;
  1309.     STDMETHOD(SetArguments)(THIS_ LPCWSTR pszArgs) PURE;
  1310.  
  1311.     STDMETHOD(GetHotkey)(THIS_ WORD *pwHotkey) PURE;
  1312.     STDMETHOD(SetHotkey)(THIS_ WORD wHotkey) PURE;
  1313.  
  1314.     STDMETHOD(GetShowCmd)(THIS_ int *piShowCmd) PURE;
  1315.     STDMETHOD(SetShowCmd)(THIS_ int iShowCmd) PURE;
  1316.  
  1317.     STDMETHOD(GetIconLocation)(THIS_ LPWSTR pszIconPath, int cchIconPath, int *piIcon) PURE;
  1318.     STDMETHOD(SetIconLocation)(THIS_ LPCWSTR pszIconPath, int iIcon) PURE;
  1319.  
  1320.     STDMETHOD(SetRelativePath)(THIS_ LPCWSTR pszPathRel, DWORD dwReserved) PURE;
  1321.  
  1322.     STDMETHOD(Resolve)(THIS_ HWND hwnd, DWORD fFlags) PURE;
  1323.  
  1324.     STDMETHOD(SetPath)(THIS_ LPCWSTR pszFile) PURE;
  1325. };
  1326.  
  1327. #if (_WIN32_IE >= 0x0400)
  1328.  
  1329. // IShellLinkDataList::GetFlags()/SetFlags()
  1330. typedef enum {
  1331.    SLDF_HAS_ID_LIST         = 0x00000001,   // Shell link saved with ID list
  1332.    SLDF_HAS_LINK_INFO       = 0x00000002,   // Shell link saved with LinkInfo
  1333.    SLDF_HAS_NAME            = 0x00000004,
  1334.    SLDF_HAS_RELPATH         = 0x00000008,
  1335.    SLDF_HAS_WORKINGDIR      = 0x00000010,
  1336.    SLDF_HAS_ARGS            = 0x00000020,
  1337.    SLDF_HAS_ICONLOCATION    = 0x00000040,
  1338.    SLDF_UNICODE             = 0x00000080,   // the strings are unicode
  1339.    SLDF_FORCE_NO_LINKINFO   = 0x00000100,   // don't create a LINKINFO (make a dumb link)
  1340.    SLDF_HAS_EXP_SZ          = 0x00000200,   // the link contains expandable env strings
  1341.    SLDF_RUN_IN_SEPARATE     = 0x00000400,   // Run the 16-bit target exe in a separate VDM/WOW
  1342.    SLDF_HAS_LOGO3ID         = 0x00000800,   // this link is a special Logo3/MSICD link
  1343.    SLDF_HAS_DARWINID        = 0x00001000,   // this link is a special Darwin link
  1344.    SLDF_RUNAS_USER          = 0x00002000,   // Run this link as a different user
  1345.    SLDF_HAS_EXP_ICON_SZ     = 0x00004000    // contains expandable env string for icon path
  1346. } SHELL_LINK_DATA_FLAGS;
  1347.  
  1348. //
  1349. // We conditionally define it here to break the circular dependency between
  1350. // shlobj and shlwapi.
  1351. //
  1352. #ifndef __DATABLOCKHEADER_DEFINED
  1353. #define __DATABLOCKHEADER_DEFINED
  1354. typedef struct tagDATABLOCKHEADER
  1355. {
  1356.     DWORD   cbSize;             // Size of this extra data block
  1357.     DWORD   dwSignature;        // signature of this extra data block
  1358. } DATABLOCK_HEADER, *LPDATABLOCK_HEADER, *LPDBLIST;
  1359. #endif
  1360.  
  1361. typedef struct {
  1362. #ifdef __cplusplus
  1363.     DATABLOCK_HEADER dbh;
  1364. #else
  1365.     DATABLOCK_HEADER;
  1366. #endif
  1367.     WORD     wFillAttribute;         // fill attribute for console
  1368.     WORD     wPopupFillAttribute;    // fill attribute for console popups
  1369.     COORD    dwScreenBufferSize;     // screen buffer size for console
  1370.     COORD    dwWindowSize;           // window size for console
  1371.     COORD    dwWindowOrigin;         // window origin for console
  1372.     DWORD    nFont;
  1373.     DWORD    nInputBufferSize;
  1374.     COORD    dwFontSize;
  1375.     UINT     uFontFamily;
  1376.     UINT     uFontWeight;
  1377.     WCHAR    FaceName[LF_FACESIZE];
  1378.     UINT     uCursorSize;
  1379.     BOOL     bFullScreen;
  1380.     BOOL     bQuickEdit;
  1381.     BOOL     bInsertMode;
  1382.     BOOL     bAutoPosition;
  1383.     UINT     uHistoryBufferSize;
  1384.     UINT     uNumberOfHistoryBuffers;
  1385.     BOOL     bHistoryNoDup;
  1386.     COLORREF ColorTable[ 16 ];
  1387. } NT_CONSOLE_PROPS, *LPNT_CONSOLE_PROPS;
  1388. #define NT_CONSOLE_PROPS_SIG 0xA0000002
  1389.  
  1390. // This is a FE Console property
  1391. typedef struct {
  1392. #ifdef __cplusplus
  1393.     DATABLOCK_HEADER dbh;
  1394. #else
  1395.     DATABLOCK_HEADER;
  1396. #endif
  1397.     UINT     uCodePage;
  1398. } NT_FE_CONSOLE_PROPS, *LPNT_FE_CONSOLE_PROPS;
  1399. #define NT_FE_CONSOLE_PROPS_SIG 0xA0000004
  1400.  
  1401. #if (_WIN32_IE >= 0x0500)
  1402. typedef struct {
  1403. #ifdef __cplusplus
  1404.     DATABLOCK_HEADER dbh;
  1405. #else
  1406.     DATABLOCK_HEADER;
  1407. #endif
  1408.     CHAR        szDarwinID[MAX_PATH];  // ANSI darwin ID associated with link
  1409.     WCHAR       szwDarwinID[MAX_PATH]; // UNICODE darwin ID associated with link
  1410. } EXP_DARWIN_LINK, *LPEXP_DARWIN_LINK;
  1411. #define EXP_DARWIN_ID_SIG       0xA0000006
  1412. #define EXP_LOGO3_ID_SIG        0xA0000007
  1413. #endif
  1414.  
  1415. #define EXP_SPECIAL_FOLDER_SIG         0xA0000005   // LPEXP_SPECIAL_FOLDER
  1416.  
  1417.  
  1418. typedef struct
  1419. {
  1420.     DWORD       cbSize;             // Size of this extra data block
  1421.     DWORD       dwSignature;        // signature of this extra data block
  1422.     DWORD       idSpecialFolder;    // special folder id this link points into
  1423.     DWORD       cbOffset;           // ofset into pidl from SLDF_HAS_ID_LIST for child
  1424. } EXP_SPECIAL_FOLDER, *LPEXP_SPECIAL_FOLDER;
  1425.  
  1426.  
  1427.  
  1428. typedef struct
  1429. {
  1430.     DWORD       cbSize;             // Size of this extra data block
  1431.     DWORD       dwSignature;        // signature of this extra data block
  1432.     CHAR        szTarget[ MAX_PATH ];   // ANSI target name w/EXP_SZ in it
  1433.     WCHAR       swzTarget[ MAX_PATH ];  // UNICODE target name w/EXP_SZ in it
  1434. } EXP_SZ_LINK, *LPEXP_SZ_LINK;
  1435. #define EXP_SZ_LINK_SIG                0xA0000001   // LPEXP_SZ_LINK (target)
  1436. #define EXP_SZ_ICON_SIG                0xA0000007   // LPEXP_SZ_LINK (icon)
  1437.  
  1438. #undef  INTERFACE
  1439. #define INTERFACE IShellLinkDataList
  1440.  
  1441. DECLARE_INTERFACE_(IShellLinkDataList, IUnknown)
  1442. {
  1443.     // *** IUnknown methods ***
  1444.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
  1445.     STDMETHOD_(ULONG, AddRef) (THIS)  PURE;
  1446.     STDMETHOD_(ULONG, Release) (THIS) PURE;
  1447.  
  1448.     // *** IShellLinkDataList methods ***
  1449.     STDMETHOD(AddDataBlock)(THIS_ void * pDataBlock) PURE;
  1450.     STDMETHOD(CopyDataBlock)(THIS_ DWORD dwSig, void **ppDataBlock) PURE;
  1451.     STDMETHOD(RemoveDataBlock)(THIS_ DWORD dwSig) PURE;
  1452.     STDMETHOD(GetFlags)(THIS_ DWORD *pdwFlags) PURE;
  1453.     STDMETHOD(SetFlags)(THIS_ DWORD dwFlags) PURE;
  1454. };
  1455.  
  1456. #endif // (_WIN32_IE >= 0x0400)
  1457.  
  1458. #if (_WIN32_IE >= 0x0500)
  1459. #undef  INTERFACE
  1460. #define INTERFACE IResolveShellLink
  1461.  
  1462. DECLARE_INTERFACE_(IResolveShellLink, IUnknown)
  1463. {
  1464.     // *** IUnknown methods ***
  1465.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
  1466.     STDMETHOD_(ULONG, AddRef) (THIS)  PURE;
  1467.     STDMETHOD_(ULONG, Release) (THIS) PURE;
  1468.  
  1469.     // *** IResolveShellLink methods ***
  1470.     STDMETHOD(ResolveShellLink)(THIS_ IUnknown* punk, HWND hwnd, DWORD fFlags) PURE;
  1471. };
  1472. #endif // (_WIN32_IE >= 0x0500)
  1473.  
  1474.  
  1475. #ifdef _INC_SHELLAPI    /* for LPSHELLEXECUTEINFO */
  1476. //===========================================================================
  1477. //
  1478. // IShellExecuteHook Interface
  1479. //
  1480. //===========================================================================
  1481.  
  1482. #undef  INTERFACE
  1483. #define INTERFACE   IShellExecuteHookA
  1484.  
  1485. DECLARE_INTERFACE_(IShellExecuteHookA, IUnknown) // shexhk
  1486. {
  1487.     // *** IUnknown methods ***
  1488.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
  1489.     STDMETHOD_(ULONG, AddRef) (THIS)  PURE;
  1490.     STDMETHOD_(ULONG, Release) (THIS) PURE;
  1491.  
  1492.     // *** IShellExecuteHookA methods ***
  1493.     STDMETHOD(Execute)(THIS_ LPSHELLEXECUTEINFOA pei) PURE;
  1494. };
  1495.  
  1496. #undef  INTERFACE
  1497. #define INTERFACE   IShellExecuteHookW
  1498.  
  1499. DECLARE_INTERFACE_(IShellExecuteHookW, IUnknown) // shexhk
  1500. {
  1501.     // *** IUnknown methods ***
  1502.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
  1503.     STDMETHOD_(ULONG, AddRef) (THIS)  PURE;
  1504.     STDMETHOD_(ULONG, Release) (THIS) PURE;
  1505.  
  1506.     // *** IShellExecuteHookW methods ***
  1507.     STDMETHOD(Execute)(THIS_ LPSHELLEXECUTEINFOW pei) PURE;
  1508. };
  1509.  
  1510. #ifdef UNICODE
  1511. #define IShellExecuteHook       IShellExecuteHookW
  1512. #define IShellExecuteHookVtbl   IShellExecuteHookWVtbl
  1513. #else
  1514. #define IShellExecuteHook       IShellExecuteHookA
  1515. #define IShellExecuteHookVtbl   IShellExecuteHookAVtbl
  1516. #endif
  1517. #endif
  1518.  
  1519. //===========================================================================
  1520. //
  1521. // IURLSearchHook Interface
  1522. //
  1523. //===========================================================================
  1524.  
  1525. #undef  INTERFACE
  1526. #define INTERFACE   IURLSearchHook
  1527.  
  1528. DECLARE_INTERFACE_(IURLSearchHook, IUnknown)
  1529. {
  1530.     // *** IUnknown methods ***
  1531.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
  1532.     STDMETHOD_(ULONG, AddRef) (THIS)  PURE;
  1533.     STDMETHOD_(ULONG, Release) (THIS) PURE;
  1534.  
  1535.     // *** IURLSearchHook methods ***
  1536.     STDMETHOD(Translate)(THIS_ LPWSTR lpwszSearchURL, DWORD cchBufferSize) PURE;
  1537. };
  1538.  
  1539. //===========================================================================
  1540. //
  1541. // INewShortcutHook Interface
  1542. //
  1543. //===========================================================================
  1544.  
  1545. #undef  INTERFACE
  1546. #define INTERFACE   INewShortcutHookA
  1547.  
  1548. DECLARE_INTERFACE_(INewShortcutHookA, IUnknown) // nshhk
  1549. {
  1550.     // *** IUnknown methods ***
  1551.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
  1552.     STDMETHOD_(ULONG, AddRef) (THIS)  PURE;
  1553.     STDMETHOD_(ULONG, Release) (THIS) PURE;
  1554.  
  1555.     // *** INewShortcutHook methods ***
  1556.     STDMETHOD(SetReferent)(THIS_ LPCSTR pcszReferent, HWND hwnd) PURE;
  1557.     STDMETHOD(GetReferent)(THIS_ LPSTR pszReferent, int cchReferent) PURE;
  1558.     STDMETHOD(SetFolder)(THIS_ LPCSTR pcszFolder) PURE;
  1559.     STDMETHOD(GetFolder)(THIS_ LPSTR pszFolder, int cchFolder) PURE;
  1560.     STDMETHOD(GetName)(THIS_ LPSTR pszName, int cchName) PURE;
  1561.     STDMETHOD(GetExtension)(THIS_ LPSTR pszExtension, int cchExtension) PURE;
  1562. };
  1563.  
  1564. #undef  INTERFACE
  1565. #define INTERFACE   INewShortcutHookW
  1566.  
  1567. DECLARE_INTERFACE_(INewShortcutHookW, IUnknown) // nshhk
  1568. {
  1569.     // *** IUnknown methods ***
  1570.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
  1571.     STDMETHOD_(ULONG, AddRef) (THIS)  PURE;
  1572.     STDMETHOD_(ULONG, Release) (THIS) PURE;
  1573.  
  1574.     // *** INewShortcutHook methods ***
  1575.     STDMETHOD(SetReferent)(THIS_ LPCWSTR pcszReferent, HWND hwnd) PURE;
  1576.     STDMETHOD(GetReferent)(THIS_ LPWSTR pszReferent, int cchReferent) PURE;
  1577.     STDMETHOD(SetFolder)(THIS_ LPCWSTR pcszFolder) PURE;
  1578.     STDMETHOD(GetFolder)(THIS_ LPWSTR pszFolder, int cchFolder) PURE;
  1579.     STDMETHOD(GetName)(THIS_ LPWSTR pszName, int cchName) PURE;
  1580.     STDMETHOD(GetExtension)(THIS_ LPWSTR pszExtension, int cchExtension) PURE;
  1581. };
  1582.  
  1583. #ifdef UNICODE
  1584. #define INewShortcutHook        INewShortcutHookW
  1585. #define INewShortcutHookVtbl    INewShortcutHookWVtbl
  1586. #else
  1587. #define INewShortcutHook        INewShortcutHookA
  1588. #define INewShortcutHookVtbl    INewShortcutHookAVtbl
  1589. #endif
  1590.  
  1591. //===========================================================================
  1592. //
  1593. // ICopyHook Interface
  1594. //
  1595. //  The copy hook is called whenever file system directories are
  1596. //  copy/moved/deleted/renamed via the shell.  It is also called by the shell
  1597. //  on changes of status of printers.
  1598. //
  1599. //  Clients register their id under STRREG_SHEX_COPYHOOK for file system hooks
  1600. //  and STRREG_SHEx_PRNCOPYHOOK for printer hooks.
  1601. //  the CopyCallback is called prior to the action, so the hook has the chance
  1602. //  to allow, deny or cancel the operation by returning the falues:
  1603. //     IDYES  -  means allow the operation
  1604. //     IDNO   -  means disallow the operation on this file, but continue with
  1605. //              any other operations (eg. batch copy)
  1606. //     IDCANCEL - means disallow the current operation and cancel any pending
  1607. //              operations
  1608. //
  1609. //   arguments to the CopyCallback
  1610. //      hwnd - window to use for any UI
  1611. //      wFunc - what operation is being done
  1612. //      wFlags - and flags (FOF_*) set in the initial call to the file operation
  1613. //      pszSrcFile - name of the source file
  1614. //      dwSrcAttribs - file attributes of the source file
  1615. //      pszDestFile - name of the destiation file (for move and renames)
  1616. //      dwDestAttribs - file attributes of the destination file
  1617. //
  1618. //
  1619. //===========================================================================
  1620.  
  1621. #ifndef FO_MOVE //these need to be kept in sync with the ones in shellapi.h
  1622.  
  1623. // file operations
  1624.  
  1625. #define FO_MOVE           0x0001
  1626. #define FO_COPY           0x0002
  1627. #define FO_DELETE         0x0003
  1628. #define FO_RENAME         0x0004
  1629.  
  1630. #define FOF_MULTIDESTFILES         0x0001
  1631. #define FOF_CONFIRMMOUSE           0x0002
  1632. #define FOF_SILENT                 0x0004  // don't create progress/report
  1633. #define FOF_RENAMEONCOLLISION      0x0008
  1634. #define FOF_NOCONFIRMATION         0x0010  // Don't prompt the user.
  1635. #define FOF_WANTMAPPINGHANDLE      0x0020  // Fill in SHFILEOPSTRUCT.hNameMappings
  1636.                                       // Must be freed using SHFreeNameMappings
  1637. #define FOF_ALLOWUNDO              0x0040
  1638. #define FOF_FILESONLY              0x0080  // on *.*, do only files
  1639. #define FOF_SIMPLEPROGRESS         0x0100  // means don't show names of files
  1640. #define FOF_NOCONFIRMMKDIR         0x0200  // don't confirm making any needed dirs
  1641. #define FOF_NOERRORUI              0x0400  // don't put up error UI
  1642. #define FOF_NOCOPYSECURITYATTRIBS  0x0800  // dont copy NT file Security Attributes
  1643. #define FOF_NORECURSION            0x1000  // don't recurse into directories.
  1644. #if (_WIN32_IE >= 0x500)
  1645. #define FOF_NO_CONNECTED_ELEMENTS  0x2000  // don't operate on connected file elements.
  1646. #define FOF_WANTNUKEWARNING        0x4000  // during delete operation, warn if nuking instead of recycling (partially overrides FOF_NOCONFIRMATION)
  1647. #endif // _WIN32_IE >= 0x500
  1648.  
  1649. typedef WORD FILEOP_FLAGS;
  1650.  
  1651. // printer operations
  1652.  
  1653. #define PO_DELETE       0x0013  // printer is being deleted
  1654. #define PO_RENAME       0x0014  // printer is being renamed
  1655. #define PO_PORTCHANGE   0x0020  // port this printer connected to is being changed
  1656.                                 // if this id is set, the strings received by
  1657.                                 // the copyhook are a doubly-null terminated
  1658.                                 // list of strings.  The first is the printer
  1659.                                 // name and the second is the printer port.
  1660. #define PO_REN_PORT     0x0034  // PO_RENAME and PO_PORTCHANGE at same time.
  1661.  
  1662. // no POF_ flags currently defined
  1663.  
  1664. typedef UINT PRINTEROP_FLAGS;
  1665.  
  1666. #endif // FO_MOVE
  1667.  
  1668. #undef  INTERFACE
  1669. #define INTERFACE   ICopyHookA
  1670.  
  1671. DECLARE_INTERFACE_(ICopyHookA, IUnknown)        // sl
  1672. {
  1673.     // *** IUnknown methods ***
  1674.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
  1675.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  1676.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  1677.  
  1678.     // *** ICopyHook methods ***
  1679.     STDMETHOD_(UINT,CopyCallback) (THIS_ HWND hwnd, UINT wFunc, UINT wFlags, LPCSTR pszSrcFile, DWORD dwSrcAttribs,
  1680.                                    LPCSTR pszDestFile, DWORD dwDestAttribs) PURE;
  1681. };
  1682.  
  1683. typedef ICopyHookA *    LPCOPYHOOKA;
  1684.  
  1685. #undef  INTERFACE
  1686. #define INTERFACE   ICopyHookW
  1687.  
  1688. DECLARE_INTERFACE_(ICopyHookW, IUnknown)        // sl
  1689. {
  1690.     // *** IUnknown methods ***
  1691.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
  1692.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  1693.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  1694.  
  1695.     // *** ICopyHook methods ***
  1696.     STDMETHOD_(UINT,CopyCallback) (THIS_ HWND hwnd, UINT wFunc, UINT wFlags, LPCWSTR pszSrcFile, DWORD dwSrcAttribs,
  1697.                                    LPCWSTR pszDestFile, DWORD dwDestAttribs) PURE;
  1698. };
  1699.  
  1700. typedef ICopyHookW *    LPCOPYHOOKW;
  1701.  
  1702. #ifdef UNICODE
  1703. #define ICopyHook       ICopyHookW
  1704. #define ICopyHookVtbl   ICopyHookWVtbl
  1705. #define LPCOPYHOOK      LPCOPYHOOKW
  1706. #else
  1707. #define ICopyHook       ICopyHookA
  1708. #define ICopyHookVtbl   ICopyHookAVtbl
  1709. #define LPCOPYHOOK      LPCOPYHOOKA
  1710. #endif
  1711.  
  1712. //===========================================================================
  1713. //
  1714. // IFileViewerSite Interface
  1715. //
  1716. //===========================================================================
  1717.  
  1718. #undef  INTERFACE
  1719. #define INTERFACE   IFileViewerSite
  1720.  
  1721. DECLARE_INTERFACE_(IFileViewerSite, IUnknown)
  1722. {
  1723.     // *** IUnknown methods ***
  1724.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
  1725.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  1726.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  1727.  
  1728.     // *** IFileViewerSite methods ***
  1729.     STDMETHOD(SetPinnedWindow) (THIS_ HWND hwnd) PURE;
  1730.     STDMETHOD(GetPinnedWindow) (THIS_ HWND *phwnd) PURE;
  1731. };
  1732.  
  1733. typedef IFileViewerSite * LPFILEVIEWERSITE;
  1734.  
  1735.  
  1736. //===========================================================================
  1737. //
  1738. // IFileViewer Interface
  1739. //
  1740. // Implemented in a FileViewer component object.  Used to tell a
  1741. // FileViewer to PrintTo or to view, the latter happening though
  1742. // ShowInitialize and Show.  The filename is always given to the
  1743. // viewer through IPersistFile.
  1744. //
  1745. //===========================================================================
  1746.  
  1747. typedef struct
  1748. {
  1749.     // Stuff passed into viewer (in)
  1750.     DWORD cbSize;           // Size of structure for future expansion...
  1751.     HWND hwndOwner;         // who is the owner window.
  1752.     int iShow;              // The show command
  1753.  
  1754.     // Passed in and updated  (in/Out)
  1755.     DWORD dwFlags;          // flags
  1756.     RECT rect;              // Where to create the window may have defaults
  1757.     IUnknown *punkRel;      // Relese this interface when window is visible
  1758.  
  1759.     // Stuff that might be returned from viewer (out)
  1760.     OLECHAR strNewFile[MAX_PATH];   // New File to view.
  1761.  
  1762. } FVSHOWINFO, *LPFVSHOWINFO;
  1763.  
  1764.     // Define File View Show Info Flags.
  1765. #define FVSIF_RECT      0x00000001      // The rect variable has valid data.
  1766. #define FVSIF_PINNED    0x00000002      // We should Initialize pinned
  1767.  
  1768. #define FVSIF_NEWFAILED 0x08000000      // The new file passed back failed
  1769.                                         // to be viewed.
  1770.  
  1771. #define FVSIF_NEWFILE   0x80000000      // A new file to view has been returned
  1772. #define FVSIF_CANVIEWIT 0x40000000      // The viewer can view it.
  1773.  
  1774. #undef  INTERFACE
  1775. #define INTERFACE   IFileViewerA
  1776.  
  1777. DECLARE_INTERFACE(IFileViewerA)
  1778. {
  1779.     // *** IUnknown methods ***
  1780.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
  1781.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  1782.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  1783.  
  1784.     // *** IFileViewer methods ***
  1785.     STDMETHOD(ShowInitialize) (THIS_ LPFILEVIEWERSITE lpfsi) PURE;
  1786.     STDMETHOD(Show) (THIS_ LPFVSHOWINFO pvsi) PURE;
  1787.     STDMETHOD(PrintTo) (THIS_ LPSTR pszDriver, BOOL fSuppressUI) PURE;
  1788. };
  1789.  
  1790. typedef IFileViewerA * LPFILEVIEWERA;
  1791.  
  1792. #undef  INTERFACE
  1793. #define INTERFACE   IFileViewerW
  1794.  
  1795. DECLARE_INTERFACE(IFileViewerW)
  1796. {
  1797.     // *** IUnknown methods ***
  1798.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
  1799.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  1800.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  1801.  
  1802.     // *** IFileViewer methods ***
  1803.     STDMETHOD(ShowInitialize) (THIS_ LPFILEVIEWERSITE lpfsi) PURE;
  1804.     STDMETHOD(Show) (THIS_ LPFVSHOWINFO pvsi) PURE;
  1805.     STDMETHOD(PrintTo) (THIS_ LPWSTR pszDriver, BOOL fSuppressUI) PURE;
  1806. };
  1807.  
  1808. typedef IFileViewerW * LPFILEVIEWERW;
  1809.  
  1810. #ifdef UNICODE
  1811. #define IFileViewer IFileViewerW
  1812. #define LPFILEVIEWER LPFILEVIEWERW
  1813. #else
  1814. #define IFileViewer IFileViewerA
  1815. #define LPFILEVIEWER LPFILEVIEWERA
  1816. #endif
  1817.  
  1818.  
  1819.  
  1820. //==========================================================================
  1821. //
  1822. // IShellBrowser/IShellView/IShellFolder interface
  1823. //
  1824. //  These three interfaces are used when the shell communicates with
  1825. // name space extensions. The shell (explorer) provides IShellBrowser
  1826. // interface, and extensions implements IShellFolder and IShellView
  1827. // interfaces.
  1828. //
  1829. //==========================================================================
  1830.  
  1831.  
  1832. //--------------------------------------------------------------------------
  1833. //
  1834. // Command/menuitem IDs
  1835. //
  1836. //  The explorer dispatches WM_COMMAND messages based on the range of
  1837. // command/menuitem IDs. All the IDs of menuitems that the view (right
  1838. // pane) inserts must be in FCIDM_SHVIEWFIRST/LAST (otherwise, the explorer
  1839. // won't dispatch them). The view should not deal with any menuitems
  1840. // in FCIDM_BROWSERFIRST/LAST (otherwise, it won't work with the future
  1841. // version of the shell).
  1842. //
  1843. //  FCIDM_SHVIEWFIRST/LAST      for the right pane (IShellView)
  1844. //  FCIDM_BROWSERFIRST/LAST     for the explorer frame (IShellBrowser)
  1845. //  FCIDM_GLOBAL/LAST           for the explorer's submenu IDs
  1846. //
  1847. //--------------------------------------------------------------------------
  1848.  
  1849. #define FCIDM_SHVIEWFIRST           0x0000
  1850. #define FCIDM_SHVIEWLAST            0x7fff
  1851. #define FCIDM_BROWSERFIRST          0xa000
  1852. #define FCIDM_BROWSERLAST           0xbf00
  1853. #define FCIDM_GLOBALFIRST           0x8000
  1854. #define FCIDM_GLOBALLAST            0x9fff
  1855.  
  1856. //
  1857. // Global submenu IDs and separator IDs
  1858. //
  1859. #define FCIDM_MENU_FILE             (FCIDM_GLOBALFIRST+0x0000)
  1860. #define FCIDM_MENU_EDIT             (FCIDM_GLOBALFIRST+0x0040)
  1861. #define FCIDM_MENU_VIEW             (FCIDM_GLOBALFIRST+0x0080)
  1862. #define FCIDM_MENU_VIEW_SEP_OPTIONS (FCIDM_GLOBALFIRST+0x0081)
  1863. #define FCIDM_MENU_TOOLS            (FCIDM_GLOBALFIRST+0x00c0) // for Win9x compat
  1864. #define FCIDM_MENU_TOOLS_SEP_GOTO   (FCIDM_GLOBALFIRST+0x00c1) // for Win9x compat
  1865. #define FCIDM_MENU_HELP             (FCIDM_GLOBALFIRST+0x0100)
  1866. #define FCIDM_MENU_FIND             (FCIDM_GLOBALFIRST+0x0140)
  1867. #define FCIDM_MENU_EXPLORE          (FCIDM_GLOBALFIRST+0x0150)
  1868. #define FCIDM_MENU_FAVORITES        (FCIDM_GLOBALFIRST+0x0170)
  1869.  
  1870. //--------------------------------------------------------------------------
  1871. // control IDs known to the view
  1872. //--------------------------------------------------------------------------
  1873.  
  1874. #define FCIDM_TOOLBAR      (FCIDM_BROWSERFIRST + 0)
  1875. #define FCIDM_STATUS       (FCIDM_BROWSERFIRST + 1)
  1876.  
  1877. #if (_WIN32_IE >= 0x0400)
  1878. //--------------------------------------------------------------------------
  1879. //
  1880. // The resource id of the offline cursor
  1881. // This cursor is avaialble in shdocvw.dll
  1882. #define IDC_OFFLINE_HAND        103
  1883. //
  1884. //--------------------------------------------------------------------------
  1885. #endif
  1886.  
  1887. //--------------------------------------------------------------------------
  1888. //
  1889. // FOLDERSETTINGS
  1890. //
  1891. //  FOLDERSETTINGS is a data structure that explorer passes from one folder
  1892. // view to another, when the user is browsing. It calls ISV::GetCurrentInfo
  1893. // member to get the current settings and pass it to ISV::CreateViewWindow
  1894. // to allow the next folder view "inherit" it. These settings assumes a
  1895. // particular UI (which the shell's folder view has), and shell extensions
  1896. // may or may not use those settings.
  1897. //
  1898. //--------------------------------------------------------------------------
  1899.  
  1900. typedef LPBYTE LPVIEWSETTINGS;
  1901.  
  1902. // NB Bitfields.
  1903. // FWF_DESKTOP implies FWF_TRANSPARENT/NOCLIENTEDGE/NOSCROLL
  1904. typedef enum
  1905.     {
  1906.     FWF_AUTOARRANGE =       0x0001,
  1907.     FWF_ABBREVIATEDNAMES =  0x0002,
  1908.     FWF_SNAPTOGRID =        0x0004,
  1909.     FWF_OWNERDATA =         0x0008,
  1910.     FWF_BESTFITWINDOW =     0x0010,
  1911.     FWF_DESKTOP =           0x0020,
  1912.     FWF_SINGLESEL =         0x0040,
  1913.     FWF_NOSUBFOLDERS =      0x0080,
  1914.     FWF_TRANSPARENT  =      0x0100,
  1915.     FWF_NOCLIENTEDGE =      0x0200,
  1916.     FWF_NOSCROLL     =      0x0400,
  1917.     FWF_ALIGNLEFT    =      0x0800,
  1918.     FWF_NOICONS      =      0x1000,
  1919.     FWF_SHOWSELALWAYS =     0x2000,
  1920.     FWF_NOVISIBLE    =      0X4000,
  1921.     FWF_SINGLECLICKACTIVATE=0x8000  // TEMPORARY -- NO UI FOR THIS
  1922.     } FOLDERFLAGS;
  1923.  
  1924. typedef enum
  1925.     {
  1926.     FVM_ICON =              1,
  1927.     FVM_SMALLICON =         2,
  1928.     FVM_LIST =              3,
  1929.     FVM_DETAILS =           4,
  1930.     } FOLDERVIEWMODE;
  1931.  
  1932. typedef struct
  1933.     {
  1934.     UINT ViewMode;       // View mode (FOLDERVIEWMODE values)
  1935.     UINT fFlags;         // View options (FOLDERFLAGS bits)
  1936.     } FOLDERSETTINGS, *LPFOLDERSETTINGS;
  1937.  
  1938. typedef const FOLDERSETTINGS * LPCFOLDERSETTINGS;
  1939.  
  1940. //--------------------------------------------------------------------------
  1941. //
  1942. // Interface:   IShellBrowser
  1943. //
  1944. //  IShellBrowser interface is the interface that is provided by the shell
  1945. // explorer/folder frame window. When it creates the "contents pane" of
  1946. // a shell folder (which provides IShellFolder interface), it calls its
  1947. // CreateViewObject member function to create an IShellView object. Then,
  1948. // it calls its CreateViewWindow member to create the "contents pane"
  1949. // window. The pointer to the IShellBrowser interface is passed to
  1950. // the IShellView object as a parameter to this CreateViewWindow member
  1951. // function call.
  1952. //
  1953. //    +--------------------------+  <-- Explorer window
  1954. //    | [] Explorer              |
  1955. //    |--------------------------+       IShellBrowser
  1956. //    | File Edit View ..        |
  1957. //    |--------------------------|
  1958. //    |        |                 |
  1959. //    |        |              <-------- Content pane
  1960. //    |        |                 |
  1961. //    |        |                 |       IShellView
  1962. //    |        |                 |
  1963. //    |        |                 |
  1964. //    +--------------------------+
  1965. //
  1966. //
  1967. //
  1968. // [Member functions]
  1969. //
  1970. //
  1971. // IShellBrowser::GetWindow(phwnd)
  1972. //
  1973. //   Inherited from IOleWindow::GetWindow.
  1974. //
  1975. //
  1976. // IShellBrowser::ContextSensitiveHelp(fEnterMode)
  1977. //
  1978. //   Inherited from IOleWindow::ContextSensitiveHelp.
  1979. //
  1980. //
  1981. // IShellBrowser::InsertMenusSB(hmenuShared, lpMenuWidths)
  1982. //
  1983. //   Similar to the IOleInPlaceFrame::InsertMenus. The explorer will put
  1984. //  "File" and "Edit" pulldown in the File menu group, "View" and "Tools"
  1985. //  in the Container menu group and "Help" in the Window menu group. Each
  1986. //  pulldown menu will have a uniqu ID, FCIDM_MENU_FILE/EDIT/VIEW/TOOLS/HELP.
  1987. //  The view is allowed to insert menuitems into those sub-menus by those
  1988. //  IDs must be between FCIDM_SHVIEWFIRST and FCIDM_SHVIEWLAST.
  1989. //
  1990. //
  1991. // IShellBrowser::SetMenuSB(hmenuShared, holemenu, hwndActiveObject)
  1992. //
  1993. //   Similar to the IOleInPlaceFrame::SetMenu. The explorer ignores the
  1994. //  holemenu parameter (reserved for future enhancement)  and performs
  1995. //  menu-dispatch based on the menuitem IDs (see the description above).
  1996. //  It is important to note that the explorer will add different
  1997. //  set of menuitems depending on whether the view has a focus or not.
  1998. //  Therefore, it is very important to call ISB::OnViewWindowActivate
  1999. //  whenever the view window (or its children) gets the focus.
  2000. //
  2001. //
  2002. // IShellBrowser::RemoveMenusSB(hmenuShared)
  2003. //
  2004. //   Same as the IOleInPlaceFrame::RemoveMenus.
  2005. //
  2006. //
  2007. // IShellBrowser::SetStatusTextSB(pszStatusText)
  2008. //
  2009. //   Same as the IOleInPlaceFrame::SetStatusText. It is also possible to
  2010. //  send messages directly to the status window via SendControlMsg.
  2011. //
  2012. //
  2013. // IShellBrowser::EnableModelessSB(fEnable)
  2014. //
  2015. //   Same as the IOleInPlaceFrame::EnableModeless.
  2016. //
  2017. //
  2018. // IShellBrowser::TranslateAcceleratorSB(lpmsg, wID)
  2019. //
  2020. //   Same as the IOleInPlaceFrame::TranslateAccelerator, but will be
  2021. //  never called because we don't support EXEs (i.e., the explorer has
  2022. //  the message loop). This member function is defined here for possible
  2023. //  future enhancement.
  2024. //
  2025. //
  2026. // IShellBrowser::BrowseObject(pidl, wFlags)
  2027. //
  2028. //   The view calls this member to let shell explorer browse to another
  2029. //  folder. The pidl and wFlags specifies the folder to be browsed.
  2030. //
  2031. //  Following three flags specifies whether it creates another window or not.
  2032. //   SBSP_SAMEBROWSER  -- Browse to another folder with the same window.
  2033. //   SBSP_NEWBROWSER   -- Creates another window for the specified folder.
  2034. //   SBSP_DEFBROWSER   -- Default behavior (respects the view option).
  2035. //
  2036. //  Following three flags specifies open, explore, or default mode. These   .
  2037. //  are ignored if SBSP_SAMEBROWSER or (SBSP_DEFBROWSER && (single window   .
  2038. //  browser || explorer)).                                                  .
  2039. //   SBSP_OPENMODE     -- Use a normal folder window
  2040. //   SBSP_EXPLOREMODE  -- Use an explorer window
  2041. //   SBSP_DEFMODE      -- Use the same as the current window
  2042. //
  2043. //  Following three flags specifies the pidl.
  2044. //   SBSP_ABSOLUTE -- pidl is an absolute pidl (relative from desktop)
  2045. //   SBSP_RELATIVE -- pidl is relative from the current folder.
  2046. //   SBSP_PARENT   -- Browse the parent folder (ignores the pidl)
  2047. //   SBSP_NAVIGATEBACK    -- Navigate back (ignores the pidl)
  2048. //   SBSP_NAVIGATEFORWARD -- Navigate forward (ignores the pidl)
  2049. //
  2050. //  Following two flags control history manipulation as result of navigate
  2051. //   SBSP_WRITENOHISTORY -- write no history (shell folder) entry
  2052. //   SBSP_NOAUTOSELECT -- suppress selection in history pane
  2053. //
  2054. // IShellBrowser::GetViewStateStream(grfMode, ppstm)
  2055. //
  2056. //   The browser returns an IStream interface as the storage for view
  2057. //  specific state information.
  2058. //
  2059. //   grfMode -- Specifies the read/write access (STGM_READ/WRITE/READWRITE)
  2060. //   ppstm   -- Specifies the IStream *variable to be filled.
  2061. //
  2062. //
  2063. // IShellBrowser::GetControlWindow(id, phwnd)
  2064. //
  2065. //   The shell view may call this member function to get the window handle
  2066. //  of Explorer controls (toolbar or status winodw -- FCW_TOOLBAR or
  2067. //  FCW_STATUS).
  2068. //
  2069. //
  2070. // IShellBrowser::SendControlMsg(id, uMsg, wParam, lParam, pret)
  2071. //
  2072. //   The shell view calls this member function to send control messages to
  2073. //  one of Explorer controls (toolbar or status window -- FCW_TOOLBAR or
  2074. //  FCW_STATUS).
  2075. //
  2076. //
  2077. // IShellBrowser::QueryActiveShellView(IShellView * ppshv)
  2078. //
  2079. //   This member returns currently activated (displayed) shellview object.
  2080. //  A shellview never need to call this member function.
  2081. //
  2082. //
  2083. // IShellBrowser::OnViewWindowActive(pshv)
  2084. //
  2085. //   The shell view window calls this member function when the view window
  2086. //  (or one of its children) got the focus. It MUST call this member before
  2087. //  calling IShellBrowser::InsertMenus, because it will insert different
  2088. //  set of menu items depending on whether the view has the focus or not.
  2089. //
  2090. //
  2091. // IShellBrowser::SetToolbarItems(lpButtons, nButtons, uFlags)
  2092. //
  2093. //   The view calls this function to add toolbar items to the exporer's
  2094. //  toolbar. "lpButtons" and "nButtons" specifies the array of toolbar
  2095. //  items. "uFlags" must be one of FCT_MERGE, FCT_CONFIGABLE, FCT_ADDTOEND.
  2096. //
  2097. //-------------------------------------------------------------------------
  2098.  
  2099. //
  2100. // Values for wFlags parameter of ISB::BrowseObject() member.
  2101. //
  2102. #define SBSP_DEFBROWSER         0x0000
  2103. #define SBSP_SAMEBROWSER        0x0001
  2104. #define SBSP_NEWBROWSER         0x0002
  2105.  
  2106. #define SBSP_DEFMODE            0x0000
  2107. #define SBSP_OPENMODE           0x0010
  2108. #define SBSP_EXPLOREMODE        0x0020
  2109. #define SBSP_HELPMODE           0x0040 // IEUNIX : Help window uses this.
  2110. #define SBSP_NOTRANSFERHIST     0x0080 // IEUNIX only mode.
  2111.  
  2112. #define SBSP_ABSOLUTE           0x0000
  2113. #define SBSP_RELATIVE           0x1000
  2114. #define SBSP_PARENT             0x2000
  2115. #define SBSP_NAVIGATEBACK       0x4000
  2116. #define SBSP_NAVIGATEFORWARD    0x8000
  2117.  
  2118. #define SBSP_ALLOW_AUTONAVIGATE 0x10000
  2119.  
  2120. #define SBSP_INITIATEDBYHLINKFRAME        0x80000000
  2121. #define SBSP_REDIRECT                     0x40000000
  2122.  
  2123. #define SBSP_WRITENOHISTORY     0x08000000
  2124. #define SBSP_NOAUTOSELECT       0x04000000
  2125.  
  2126.  
  2127. //
  2128. // Values for id parameter of ISB::GetWindow/SendControlMsg members.
  2129. //
  2130. // WARNING:
  2131. //  Any shell extensions which sends messages to those control windows
  2132. // might not work in the future version of windows. If you really need
  2133. // to send messages to them, (1) don't assume that those control window
  2134. // always exist (i.e. GetControlWindow may fail) and (2) verify the window
  2135. // class of the window before sending any messages.
  2136. //
  2137. #define FCW_STATUS      0x0001
  2138. #define FCW_TOOLBAR     0x0002
  2139. #define FCW_TREE        0x0003
  2140. #define FCW_INTERNETBAR 0x0006
  2141. #define FCW_PROGRESS    0x0008
  2142.  
  2143. #if (_WIN32_IE >= 0x0400)
  2144. #endif
  2145.  
  2146. //
  2147. // Values for uFlags paremeter of ISB::SetToolbarItems member.
  2148. //
  2149. #define FCT_MERGE       0x0001
  2150. #define FCT_CONFIGABLE  0x0002
  2151. #define FCT_ADDTOEND    0x0004
  2152.  
  2153.  
  2154. #undef  INTERFACE
  2155. #define INTERFACE   IShellBrowser
  2156.  
  2157. DECLARE_INTERFACE_(IShellBrowser, IOleWindow)
  2158. {
  2159.     // *** IUnknown methods ***
  2160.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
  2161.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  2162.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  2163.  
  2164.     // *** IOleWindow methods ***
  2165.     STDMETHOD(GetWindow) (THIS_ HWND * lphwnd) PURE;
  2166.     STDMETHOD(ContextSensitiveHelp) (THIS_ BOOL fEnterMode) PURE;
  2167.  
  2168.     // *** IShellBrowser methods *** (same as IOleInPlaceFrame)
  2169.     STDMETHOD(InsertMenusSB)(THIS_ HMENU hmenuShared, LPOLEMENUGROUPWIDTHS lpMenuWidths) PURE;
  2170.     STDMETHOD(SetMenuSB)(THIS_ HMENU hmenuShared, HOLEMENU holemenuRes, HWND hwndActiveObject) PURE;
  2171.     STDMETHOD(RemoveMenusSB) (THIS_ HMENU hmenuShared) PURE;
  2172.     STDMETHOD(SetStatusTextSB) (THIS_ LPCOLESTR pszStatusText) PURE;
  2173.     STDMETHOD(EnableModelessSB) (THIS_ BOOL fEnable) PURE;
  2174.     STDMETHOD(TranslateAcceleratorSB) (THIS_ MSG *pmsg, WORD wID) PURE;
  2175.  
  2176.     // *** IShellBrowser methods ***
  2177.     STDMETHOD(BrowseObject)(THIS_ LPCITEMIDLIST pidl, UINT wFlags) PURE;
  2178.     STDMETHOD(GetViewStateStream)(THIS_ DWORD grfMode, IStream **ppStrm) PURE;
  2179.     STDMETHOD(GetControlWindow)(THIS_ UINT id, HWND * lphwnd) PURE;
  2180.     STDMETHOD(SendControlMsg)(THIS_ UINT id, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *pret) PURE;
  2181.     STDMETHOD(QueryActiveShellView)(THIS_ struct IShellView **ppshv) PURE;
  2182.     STDMETHOD(OnViewWindowActive)(THIS_ struct IShellView *ppshv) PURE;
  2183.     STDMETHOD(SetToolbarItems)(THIS_ LPTBBUTTON lpButtons, UINT nButtons, UINT uFlags) PURE;
  2184. };
  2185. #define __IShellBrowser_INTERFACE_DEFINED__
  2186.  
  2187. typedef IShellBrowser * LPSHELLBROWSER;
  2188.  
  2189. enum {
  2190.     SBSC_HIDE = 0,
  2191.     SBSC_SHOW = 1,
  2192.     SBSC_TOGGLE = 2,
  2193.     SBSC_QUERY =  3
  2194. };
  2195.  
  2196. enum {
  2197.         SBO_DEFAULT = 0 ,
  2198.         SBO_NOBROWSERPAGES = 1
  2199. };
  2200.  
  2201.  
  2202. //-------------------------------------------------------------------------
  2203. // ICommDlgBrowser interface
  2204. //
  2205. //  ICommDlgBrowser interface is the interface that is provided by the new
  2206. // common dialog window to hook and modify the behavior of IShellView.  When
  2207. // a default view is created, it queries its parent IShellBrowser for the
  2208. // ICommDlgBrowser interface.  If supported, it calls out to that interface
  2209. // in several cases that need to behave differently in a dialog.
  2210. //
  2211. // Member functions:
  2212. //
  2213. //  ICommDlgBrowser::OnDefaultCommand()
  2214. //    Called when the user double-clicks in the view or presses Enter.  The
  2215. //   browser should return S_OK if it processed the action itself, S_FALSE
  2216. //   to let the view perform the default action.
  2217. //
  2218. //  ICommDlgBrowser::OnStateChange(ULONG uChange)
  2219. //    Called when some states in the view change.  'uChange' is one of the
  2220. //   CDBOSC_* values.  This call is made after the state (selection, focus,
  2221. //   etc) has changed.  There is no return value.
  2222. //
  2223. //  ICommDlgBrowser::IncludeObject(LPCITEMIDLIST pidl)
  2224. //    Called when the view is enumerating objects.  'pidl' is a relative
  2225. //   IDLIST.  The browser should return S_OK to include the object in the
  2226. //   view, S_FALSE to hide it
  2227. //
  2228. //-------------------------------------------------------------------------
  2229.  
  2230. #define CDBOSC_SETFOCUS     0x00000000
  2231. #define CDBOSC_KILLFOCUS    0x00000001
  2232. #define CDBOSC_SELCHANGE    0x00000002
  2233. #define CDBOSC_RENAME       0x00000003
  2234.  
  2235. #undef  INTERFACE
  2236. #define INTERFACE   ICommDlgBrowser
  2237.  
  2238. DECLARE_INTERFACE_(ICommDlgBrowser, IUnknown)
  2239. {
  2240.     // *** IUnknown methods ***
  2241.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
  2242.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  2243.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  2244.  
  2245.     // *** ICommDlgBrowser methods ***
  2246.     STDMETHOD(OnDefaultCommand) (THIS_ struct IShellView * ppshv) PURE;
  2247.     STDMETHOD(OnStateChange) (THIS_ struct IShellView * ppshv,
  2248.                 ULONG uChange) PURE;
  2249.     STDMETHOD(IncludeObject) (THIS_ struct IShellView * ppshv,
  2250.                 LPCITEMIDLIST pidl) PURE;
  2251. };
  2252.  
  2253. typedef ICommDlgBrowser * LPCOMMDLGBROWSER;
  2254.  
  2255. //-------------------------------------------------------------------------
  2256. // ICommDlgBrowser2 interface
  2257. //
  2258. // Member functions:
  2259. //
  2260. //  ICommDlgBrowser2::Notify(IShellView *pshv, DWORD dwNotfyType)
  2261. //   Called when the view is wants to notify common dialog when an event
  2262. //  occurrs.
  2263. //
  2264. //  CDB2N_CONTEXTMENU_START indicates the context menu has started.
  2265. //  CDB2N_CONTEXTMENU_DONE  indicates the context menu has completed.
  2266. //
  2267. //  ICommDlgBrowser2::GetDefaultMenuText(IShellView *pshv,
  2268. //                                      WCHAR *pszText, INT cchMax)
  2269. //   Called when the view wants to get the default context menu text.
  2270. //  pszText points to buffer and cchMax specifies the size of the
  2271. //  buffer in characters.  The browser on return has filled the buffer
  2272. //  with the default context menu text.  The Shell will call this method
  2273. //  with at least a buffer size of MAX_PATH.  The browser should return
  2274. //  S_OK if it returned a new default menu text, S_FALSE to let the view
  2275. //  to use the normal default menu text.
  2276. //
  2277. //  ICommDlgBrowser2::GetViewFlags(DWORD *pdwFlags)
  2278. //     Called when the view wants to determine  if special customization needs to
  2279. //    be done for the common dialog browser. For example View calls this function to
  2280. //    determin if all files(hidden and system)needs to be shown. If the GetViewFlags returns a DWORD with
  2281. //    CDB2GVF_SHOWALLFILES  flag set then it will show all the files.
  2282. //-------------------------------------------------------------------------
  2283.  
  2284. #define CDB2N_CONTEXTMENU_DONE  0x00000001
  2285. #define CDB2N_CONTEXTMENU_START 0x00000002
  2286.  
  2287. //GetViewFlags
  2288. #define CDB2GVF_SHOWALLFILES        0x00000001
  2289.  
  2290. #undef  INTERFACE
  2291. #define INTERFACE   ICommDlgBrowser2
  2292.  
  2293. DECLARE_INTERFACE_(ICommDlgBrowser2, IUnknown)
  2294. {
  2295.     // *** IUnknown methods ***
  2296.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
  2297.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  2298.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  2299.  
  2300.     // *** ICommDlgBrowser methods ***
  2301.     STDMETHOD(OnDefaultCommand) (THIS_ struct IShellView * ppshv) PURE;
  2302.     STDMETHOD(OnStateChange) (THIS_ struct IShellView * ppshv,
  2303.                 ULONG uChange) PURE;
  2304.     STDMETHOD(IncludeObject) (THIS_ struct IShellView * ppshv,
  2305.                 LPCITEMIDLIST pidl) PURE;
  2306.  
  2307.     // *** ICommDlgBrowser2 methods ***
  2308.     STDMETHOD(Notify) (THIS_ struct IShellView * ppshv,
  2309.                 DWORD dwNotifyType) PURE;
  2310.     STDMETHOD(GetDefaultMenuText) (THIS_ struct IShellView * ppshv,
  2311.                 WCHAR *pszText, INT cchMax) PURE;
  2312.     STDMETHOD(GetViewFlags)(THIS_ DWORD *pdwFlags) PURE;
  2313.  
  2314. };
  2315.  
  2316. typedef ICommDlgBrowser2 * LPCOMMDLGBROWSER2;
  2317.  
  2318.  
  2319. //==========================================================================
  2320. //
  2321. // Interface:   IShellView
  2322. //
  2323. // IShellView::GetWindow(phwnd)
  2324. //
  2325. //   Inherited from IOleWindow::GetWindow.
  2326. //
  2327. //
  2328. // IShellView::ContextSensitiveHelp(fEnterMode)
  2329. //
  2330. //   Inherited from IOleWindow::ContextSensitiveHelp.
  2331. //
  2332. //
  2333. // IShellView::TranslateAccelerator(lpmsg)
  2334. //
  2335. //   Similar to IOleInPlaceActiveObject::TranlateAccelerator. The explorer
  2336. //  calls this function BEFORE any other translation. Returning S_OK
  2337. //  indicates that the message was translated (eaten) and should not be
  2338. //  translated or dispatched by the explorer.
  2339. //
  2340. //
  2341. // IShellView::EnableModeless(fEnable)
  2342. //   Similar to IOleInPlaceActiveObject::EnableModeless.
  2343. //
  2344. //
  2345. // IShellView::UIActivate(uState)
  2346. //
  2347. //   The explorer calls this member function whenever the activation
  2348. //  state of the view window is changed by a certain event that is
  2349. //  NOT caused by the shell view itself.
  2350. //
  2351. //   SVUIA_DEACTIVATE will be passed when the explorer is about to
  2352. //  destroy the shell view window; the shell view is supposed to remove
  2353. //  all the extended UIs (typically merged menu and modeless popup windows).
  2354. //
  2355. //   SVUIA_ACTIVATE_NOFOCUS will be passsed when the shell view is losing
  2356. //  the input focus or the shell view has been just created without the
  2357. //  input focus; the shell view is supposed to set menuitems appropriate
  2358. //  for non-focused state (no selection specific items should be added).
  2359. //
  2360. //   SVUIA_ACTIVATE_FOCUS will be passed when the explorer has just
  2361. //  created the view window with the input focus; the shell view is
  2362. //  supposed to set menuitems appropriate for focused state.
  2363. //
  2364. //   SVUIA_INPLACEACTIVATE(new) will be passed when the shell view is opened
  2365. //  within an ActiveX control, which is not a UI active. In this case,
  2366. //  the shell view should not merge menus or put toolbas. To be compatible
  2367. //  with Win95 client, we don't pass this value unless the view supports
  2368. //  IShellView2.
  2369. //
  2370. //   The shell view should not change focus within this member function.
  2371. //  The shell view should not hook the WM_KILLFOCUS message to remerge
  2372. //  menuitems. However, the shell view typically hook the WM_SETFOCUS
  2373. //  message, and re-merge the menu after calling IShellBrowser::
  2374. //  OnViewWindowActivated.
  2375. //
  2376. //   One of the ACTIVATE / INPLACEACTIVATE messages will be sent when
  2377. //  the view window becomes the currently displayed view.  On Win95 systems,
  2378. //  this will happen immediately after the CreateViewWindow call.  On IE4, Win98,
  2379. //  and NT5 systems this may happen when the view reports it is ready (if the
  2380. //  IShellView supports async creation).  This can be used as a hint as to when
  2381. //  to make your view window visible.  Note: the Win95/Win98/NT4 common dialogs
  2382. //  do not send either of these on creation.
  2383. //
  2384. //
  2385. // IShellView::Refresh()
  2386. //
  2387. //   The explorer calls this member when the view needs to refresh its
  2388. //  contents (such as when the user hits F5 key).
  2389. //
  2390. //
  2391. // IShellView::CreateViewWindow
  2392. //
  2393. //   This member creates the view window (right-pane of the explorer or the
  2394. //  client window of the folder window).
  2395. //
  2396. //
  2397. // IShellView::DestroyViewWindow
  2398. //
  2399. //   This member destroys the view window.
  2400. //
  2401. //
  2402. // IShellView::GetCurrentInfo
  2403. //
  2404. //   This member returns the folder settings.
  2405. //
  2406. //
  2407. // IShellView::AddPropertySHeetPages
  2408. //
  2409. //   The explorer calls this member when it is opening the option property
  2410. //  sheet. This allows the view to add additional pages to it.
  2411. //
  2412. //
  2413. // IShellView::SaveViewState()
  2414. //
  2415. //   The explorer calls this member when the shell view is supposed to
  2416. //  store its view settings. The shell view is supposed to get a view
  2417. //  stream by calling IShellBrowser::GetViewStateStream and store the
  2418. //  current view state into that stream.
  2419. //
  2420. //
  2421. // IShellView::SelectItem(pidlItem, uFlags)
  2422. //
  2423. //   The explorer calls this member to change the selection state of
  2424. //  item(s) within the shell view window.  If pidlItem is NULL and uFlags
  2425. //  is SVSI_DESELECTOTHERS, all items should be deselected.
  2426. //
  2427. //-------------------------------------------------------------------------
  2428.  
  2429. //
  2430. // shellview select item flags
  2431. //
  2432. #define SVSI_DESELECT   0x0000
  2433. #define SVSI_SELECT     0x0001
  2434. #define SVSI_EDIT       0x0003  // includes select
  2435. #define SVSI_DESELECTOTHERS 0x0004
  2436. #define SVSI_ENSUREVISIBLE  0x0008
  2437. #define SVSI_FOCUSED        0x0010
  2438. #define SVSI_TRANSLATEPT    0x0020
  2439.  
  2440. //
  2441. // shellview get item object flags
  2442. //
  2443. #define SVGIO_BACKGROUND    0x00000000
  2444. #define SVGIO_SELECTION     0x00000001
  2445. #define SVGIO_ALLVIEW       0x00000002
  2446.  
  2447. //
  2448. // uState values for IShellView::UIActivate
  2449. //
  2450. typedef enum {
  2451.     SVUIA_DEACTIVATE       = 0,
  2452.     SVUIA_ACTIVATE_NOFOCUS = 1,
  2453.     SVUIA_ACTIVATE_FOCUS   = 2,
  2454.     SVUIA_INPLACEACTIVATE  = 3          // new flag for IShellView2
  2455. } SVUIA_STATUS;
  2456.  
  2457. #undef  INTERFACE
  2458. #define INTERFACE   IShellView
  2459.  
  2460. DECLARE_INTERFACE_(IShellView, IOleWindow)
  2461. {
  2462.     // *** IUnknown methods ***
  2463.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
  2464.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  2465.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  2466.  
  2467.     // *** IOleWindow methods ***
  2468.     STDMETHOD(GetWindow) (THIS_ HWND * lphwnd) PURE;
  2469.     STDMETHOD(ContextSensitiveHelp) (THIS_ BOOL fEnterMode) PURE;
  2470.  
  2471.     // *** IShellView methods ***
  2472.     STDMETHOD(TranslateAccelerator) (THIS_ LPMSG lpmsg) PURE;
  2473. #ifdef _FIX_ENABLEMODELESS_CONFLICT
  2474.     STDMETHOD(EnableModelessSV) (THIS_ BOOL fEnable) PURE;
  2475. #else
  2476.     STDMETHOD(EnableModeless) (THIS_ BOOL fEnable) PURE;
  2477. #endif
  2478.     STDMETHOD(UIActivate) (THIS_ UINT uState) PURE;
  2479.     STDMETHOD(Refresh) (THIS) PURE;
  2480.  
  2481.     STDMETHOD(CreateViewWindow)(THIS_ IShellView  *lpPrevView,
  2482.                     LPCFOLDERSETTINGS lpfs, IShellBrowser  * psb,
  2483.                     RECT * prcView, HWND  *phWnd) PURE;
  2484.     STDMETHOD(DestroyViewWindow)(THIS) PURE;
  2485.     STDMETHOD(GetCurrentInfo)(THIS_ LPFOLDERSETTINGS lpfs) PURE;
  2486.     STDMETHOD(AddPropertySheetPages)(THIS_ DWORD dwReserved,
  2487.                     LPFNADDPROPSHEETPAGE lpfn, LPARAM lparam) PURE;
  2488.     STDMETHOD(SaveViewState)(THIS) PURE;
  2489.     STDMETHOD(SelectItem)(THIS_ LPCITEMIDLIST pidlItem, UINT uFlags) PURE;
  2490.     STDMETHOD(GetItemObject)(THIS_ UINT uItem, REFIID riid,
  2491.                     void **ppv) PURE;
  2492. };
  2493.  
  2494. typedef IShellView *LPSHELLVIEW;
  2495.  
  2496. typedef GUID SHELLVIEWID;
  2497.  
  2498. #define SV2GV_CURRENTVIEW ((UINT)-1)
  2499. #define SV2GV_DEFAULTVIEW ((UINT)-2)
  2500.  
  2501. #ifndef RC_INVOKED
  2502. #include <pshpack8.h>
  2503. #endif /* !RC_INVOKED */
  2504.  
  2505. typedef struct _SV2CVW2_PARAMS
  2506. {
  2507.     DWORD cbSize;
  2508.  
  2509.     IShellView *psvPrev;
  2510.     FOLDERSETTINGS const *pfs;
  2511.     IShellBrowser *psbOwner;
  2512.     RECT *prcView;
  2513.     SHELLVIEWID const *pvid;
  2514.  
  2515.     HWND hwndView;
  2516. } SV2CVW2_PARAMS;
  2517. typedef SV2CVW2_PARAMS *LPSV2CVW2_PARAMS;
  2518.  
  2519. #undef  INTERFACE
  2520. #define INTERFACE   IShellView2
  2521.  
  2522. DECLARE_INTERFACE_(IShellView2, IShellView)
  2523. {
  2524.     // *** IUnknown methods ***
  2525.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
  2526.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  2527.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  2528.  
  2529.     // *** IOleWindow methods ***
  2530.     STDMETHOD(GetWindow) (THIS_ HWND * lphwnd) PURE;
  2531.     STDMETHOD(ContextSensitiveHelp) (THIS_ BOOL fEnterMode) PURE;
  2532.  
  2533.     // *** IShellView methods ***
  2534.     STDMETHOD(TranslateAccelerator) (THIS_ LPMSG lpmsg) PURE;
  2535. #ifdef _FIX_ENABLEMODELESS_CONFLICT
  2536.     STDMETHOD(EnableModelessSV) (THIS_ BOOL fEnable) PURE;
  2537. #else
  2538.     STDMETHOD(EnableModeless) (THIS_ BOOL fEnable) PURE;
  2539. #endif
  2540.     STDMETHOD(UIActivate) (THIS_ UINT uState) PURE;
  2541.     STDMETHOD(Refresh) (THIS) PURE;
  2542.  
  2543.     STDMETHOD(CreateViewWindow)(THIS_ IShellView  *lpPrevView,
  2544.                     LPCFOLDERSETTINGS lpfs, IShellBrowser  * psb,
  2545.                     RECT * prcView, HWND  *phWnd) PURE;
  2546.     STDMETHOD(DestroyViewWindow)(THIS) PURE;
  2547.     STDMETHOD(GetCurrentInfo)(THIS_ LPFOLDERSETTINGS lpfs) PURE;
  2548.     STDMETHOD(AddPropertySheetPages)(THIS_ DWORD dwReserved,
  2549.                     LPFNADDPROPSHEETPAGE lpfn, LPARAM lparam) PURE;
  2550.     STDMETHOD(SaveViewState)(THIS) PURE;
  2551.     STDMETHOD(SelectItem)(THIS_ LPCITEMIDLIST pidlItem, UINT uFlags) PURE;
  2552.     STDMETHOD(GetItemObject)(THIS_ UINT uItem, REFIID riid,
  2553.                     void **ppv) PURE;
  2554.  
  2555.     // *** IShellView2 methods ***
  2556.     STDMETHOD(GetView)(THIS_ SHELLVIEWID* pvid, ULONG uView) PURE;
  2557.     STDMETHOD(CreateViewWindow2)(THIS_ LPSV2CVW2_PARAMS lpParams) PURE;
  2558.     STDMETHOD(HandleRename)(THIS_ LPCITEMIDLIST pidlNew) PURE;
  2559.     STDMETHOD(SelectAndPositionItem) (THIS_ LPCITEMIDLIST pidlItem,
  2560.         UINT uFlags,POINT* point) PURE;
  2561. };
  2562.  
  2563. //-------------------------------------------------------------------------
  2564. //
  2565. // struct STRRET
  2566. //
  2567. // structure for returning strings from IShellFolder member functions
  2568. //
  2569. //-------------------------------------------------------------------------
  2570. #define STRRET_WSTR     0x0000          // Use STRRET.pOleStr
  2571. #define STRRET_OFFSET   0x0001          // Use STRRET.uOffset to Ansi
  2572. #define STRRET_CSTR     0x0002          // Use STRRET.cStr
  2573.  
  2574. #ifdef NONAMELESSUNION
  2575. #define NAMELESS_MEMBER(member) DUMMYUNIONNAME.##member
  2576. #else
  2577. #define NAMELESS_MEMBER(member) member
  2578. #endif
  2579.  
  2580.  
  2581. typedef struct _STRRET
  2582. {
  2583.     UINT uType; // One of the STRRET_* values
  2584.     union
  2585.     {
  2586.         LPWSTR          pOleStr;        // must be freed by caller of GetDisplayNameOf
  2587.         LPSTR           pStr;           // NOT USED
  2588.         UINT            uOffset;        // Offset into SHITEMID
  2589.         char            cStr[MAX_PATH]; // Buffer to fill in (ANSI)
  2590.     } DUMMYUNIONNAME;
  2591. } STRRET, *LPSTRRET;
  2592.  
  2593. #ifndef RC_INVOKED
  2594. #include <poppack.h>   /* Assume byte packing throughout */
  2595. #endif /* !RC_INVOKED */
  2596.  
  2597.  
  2598. //-------------------------------------------------------------------------
  2599. //
  2600. // SHGetPathFromIDList
  2601. //
  2602. //  This function assumes the size of the buffer (MAX_PATH). The pidl
  2603. // should point to a file system object.
  2604. //
  2605. //-------------------------------------------------------------------------
  2606.  
  2607. SHSTDAPI_(BOOL) SHGetPathFromIDListA(LPCITEMIDLIST pidl, LPSTR pszPath);
  2608. SHSTDAPI_(BOOL) SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath);
  2609. #ifdef UNICODE
  2610. #define SHGetPathFromIDList  SHGetPathFromIDListW
  2611. #else
  2612. #define SHGetPathFromIDList  SHGetPathFromIDListA
  2613. #endif // !UNICODE
  2614.  
  2615. SHSTDAPI_(int) SHCreateDirectoryExA(HWND hwnd, LPCSTR pszPath, SECURITY_ATTRIBUTES *psa);
  2616. SHSTDAPI_(int) SHCreateDirectoryExW(HWND hwnd, LPCWSTR pszPath, SECURITY_ATTRIBUTES *psa);
  2617. #ifdef UNICODE
  2618. #define SHCreateDirectoryEx  SHCreateDirectoryExW
  2619. #else
  2620. #define SHCreateDirectoryEx  SHCreateDirectoryExA
  2621. #endif // !UNICODE
  2622.  
  2623. //-------------------------------------------------------------------------
  2624. //
  2625. // SHGetSpecialFolderLocation
  2626. //
  2627. //  Caller should use SHGetMalloc to obtain an allocator that can free the pidl
  2628. //
  2629. //
  2630. //-------------------------------------------------------------------------
  2631. //
  2632. // registry entries for special paths are kept in :
  2633. #define REGSTR_PATH_SPECIAL_FOLDERS    REGSTR_PATH_EXPLORER TEXT("\\Shell Folders")
  2634.  
  2635.  
  2636. #define CSIDL_DESKTOP                   0x0000        // <desktop>
  2637. #define CSIDL_INTERNET                  0x0001        // Internet Explorer (icon on desktop)
  2638. #define CSIDL_PROGRAMS                  0x0002        // Start Menu\Programs
  2639. #define CSIDL_CONTROLS                  0x0003        // My Computer\Control Panel
  2640. #define CSIDL_PRINTERS                  0x0004        // My Computer\Printers
  2641. #define CSIDL_PERSONAL                  0x0005        // My Documents
  2642. #define CSIDL_FAVORITES                 0x0006        // <user name>\Favorites
  2643. #define CSIDL_STARTUP                   0x0007        // Start Menu\Programs\Startup
  2644. #define CSIDL_RECENT                    0x0008        // <user name>\Recent
  2645. #define CSIDL_SENDTO                    0x0009        // <user name>\SendTo
  2646. #define CSIDL_BITBUCKET                 0x000a        // <desktop>\Recycle Bin
  2647. #define CSIDL_STARTMENU                 0x000b        // <user name>\Start Menu
  2648. #define CSIDL_DESKTOPDIRECTORY          0x0010        // <user name>\Desktop
  2649. #define CSIDL_DRIVES                    0x0011        // My Computer
  2650. #define CSIDL_NETWORK                   0x0012        // Network Neighborhood
  2651. #define CSIDL_NETHOOD                   0x0013        // <user name>\nethood
  2652. #define CSIDL_FONTS                     0x0014        // windows\fonts
  2653. #define CSIDL_TEMPLATES                 0x0015
  2654. #define CSIDL_COMMON_STARTMENU          0x0016        // All Users\Start Menu
  2655. #define CSIDL_COMMON_PROGRAMS           0X0017        // All Users\Programs
  2656. #define CSIDL_COMMON_STARTUP            0x0018        // All Users\Startup
  2657. #define CSIDL_COMMON_DESKTOPDIRECTORY   0x0019        // All Users\Desktop
  2658. #define CSIDL_APPDATA                   0x001a        // <user name>\Application Data
  2659. #define CSIDL_PRINTHOOD                 0x001b        // <user name>\PrintHood
  2660. #define CSIDL_LOCAL_APPDATA             0x001c        // <user name>\Local Settings\Applicaiton Data (non roaming)
  2661. #define CSIDL_ALTSTARTUP                0x001d        // non localized startup
  2662. #define CSIDL_COMMON_ALTSTARTUP         0x001e        // non localized common startup
  2663. #define CSIDL_COMMON_FAVORITES          0x001f
  2664. #define CSIDL_INTERNET_CACHE            0x0020
  2665. #define CSIDL_COOKIES                   0x0021
  2666. #define CSIDL_HISTORY                   0x0022
  2667. #define CSIDL_COMMON_APPDATA            0x0023        // All Users\Application Data
  2668. #define CSIDL_WINDOWS                   0x0024        // GetWindowsDirectory()
  2669. #define CSIDL_SYSTEM                    0x0025        // GetSystemDirectory()
  2670. #define CSIDL_PROGRAM_FILES             0x0026        // C:\Program Files
  2671. #define CSIDL_MYPICTURES                0x0027        // C:\Program Files\My Pictures
  2672. #define CSIDL_PROFILE                   0x0028        // USERPROFILE
  2673. #define CSIDL_SYSTEMX86                 0x0029        // x86 system directory on RISC
  2674. #define CSIDL_PROGRAM_FILESX86          0x002a        // x86 C:\Program Files on RISC
  2675. #define CSIDL_PROGRAM_FILES_COMMON      0x002b        // C:\Program Files\Common
  2676. #define CSIDL_PROGRAM_FILES_COMMONX86   0x002c        // x86 Program Files\Common on RISC
  2677. #define CSIDL_COMMON_TEMPLATES          0x002d        // All Users\Templates
  2678. #define CSIDL_COMMON_DOCUMENTS          0x002e        // All Users\Documents
  2679. #define CSIDL_COMMON_ADMINTOOLS         0x002f        // All Users\Start Menu\Programs\Administrative Tools
  2680. #define CSIDL_ADMINTOOLS                0x0030        // <user name>\Start Menu\Programs\Administrative Tools
  2681. #define CSIDL_CONNECTIONS               0x0031        // Network and Dial-up Connections
  2682.  
  2683. #define CSIDL_FLAG_CREATE               0x8000        // combine with CSIDL_ value to force folder creation in SHGetFolderPath()
  2684. #define CSIDL_FLAG_DONT_VERIFY          0x4000        // combine with CSIDL_ value to return an unverified folder path
  2685. #define CSIDL_FLAG_MASK                 0xFF00        // mask for all possible flag values
  2686.  
  2687.  
  2688. SHSTDAPI SHGetSpecialFolderLocation(HWND hwnd, int csidl, LPITEMIDLIST *ppidl);
  2689.  
  2690. #if (_WIN32_IE >= 0x0400)
  2691.  
  2692. SHSTDAPI_(BOOL) SHGetSpecialFolderPathA(HWND hwnd, LPSTR pszPath, int csidl, BOOL fCreate);
  2693. SHSTDAPI_(BOOL) SHGetSpecialFolderPathW(HWND hwnd, LPWSTR pszPath, int csidl, BOOL fCreate);
  2694. #ifdef UNICODE
  2695. #define SHGetSpecialFolderPath  SHGetSpecialFolderPathW
  2696. #else
  2697. #define SHGetSpecialFolderPath  SHGetSpecialFolderPathA
  2698. #endif // !UNICODE
  2699.  
  2700. #if (_WIN32_IE >= 0x0500)
  2701.  
  2702. typedef enum {
  2703.     SHGFP_TYPE_CURRENT  = 0,   // current value for user, verify it exists
  2704.     SHGFP_TYPE_DEFAULT  = 1,   // default value, may not exist
  2705. } SHGFP_TYPE;
  2706.  
  2707. SHFOLDERAPI SHGetFolderPathA(HWND hwnd, int csidl, HANDLE hToken, DWORD dwFlags, LPSTR pszPath);
  2708. SHFOLDERAPI SHGetFolderPathW(HWND hwnd, int csidl, HANDLE hToken, DWORD dwFlags, LPWSTR pszPath);
  2709. #ifdef UNICODE
  2710. #define SHGetFolderPath  SHGetFolderPathW
  2711. #else
  2712. #define SHGetFolderPath  SHGetFolderPathA
  2713. #endif // !UNICODE
  2714. SHSTDAPI SHGetFolderLocation(HWND hwnd, int csidl, HANDLE hToken, DWORD dwFlags, LPITEMIDLIST *ppidl);
  2715.  
  2716.  
  2717. #endif      // _WIN32_IE >= 0x0500
  2718.  
  2719. #endif      // _WIN32_IE >= 0x0400
  2720.  
  2721.  
  2722.  
  2723. //-------------------------------------------------------------------------
  2724. //
  2725. // SHBrowseForFolder API
  2726. //
  2727. //
  2728. //-------------------------------------------------------------------------
  2729.  
  2730. typedef int (CALLBACK* BFFCALLBACK)(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData);
  2731.  
  2732. typedef struct _browseinfoA {
  2733.     HWND        hwndOwner;
  2734.     LPCITEMIDLIST pidlRoot;
  2735.     LPSTR        pszDisplayName;    // Return display name of item selected.
  2736.     LPCSTR       lpszTitle;            // text to go in the banner over the tree.
  2737.     UINT         ulFlags;            // Flags that control the return stuff
  2738.     BFFCALLBACK  lpfn;
  2739.     LPARAM       lParam;            // extra info that's passed back in callbacks
  2740.     int          iImage;            // output var: where to return the Image index.
  2741. } BROWSEINFOA, *PBROWSEINFOA, *LPBROWSEINFOA;
  2742.  
  2743. typedef struct _browseinfoW {
  2744.     HWND        hwndOwner;
  2745.     LPCITEMIDLIST pidlRoot;
  2746.     LPWSTR       pszDisplayName;    // Return display name of item selected.
  2747.     LPCWSTR      lpszTitle;            // text to go in the banner over the tree.
  2748.     UINT         ulFlags;            // Flags that control the return stuff
  2749.     BFFCALLBACK  lpfn;
  2750.     LPARAM       lParam;            // extra info that's passed back in callbacks
  2751.     int          iImage;            // output var: where to return the Image index.
  2752. } BROWSEINFOW, *PBROWSEINFOW, *LPBROWSEINFOW;
  2753.  
  2754. #ifdef UNICODE
  2755. #define BROWSEINFO      BROWSEINFOW
  2756. #define PBROWSEINFO     PBROWSEINFOW
  2757. #define LPBROWSEINFO    LPBROWSEINFOW
  2758. #else
  2759. #define BROWSEINFO      BROWSEINFOA
  2760. #define PBROWSEINFO     PBROWSEINFOA
  2761. #define LPBROWSEINFO    LPBROWSEINFOA
  2762. #endif
  2763.  
  2764. // Browsing for directory.
  2765. #define BIF_RETURNONLYFSDIRS   0x0001  // For finding a folder to start document searching
  2766. #define BIF_DONTGOBELOWDOMAIN  0x0002  // For starting the Find Computer
  2767. #define BIF_STATUSTEXT         0x0004   // Top of the dialog has 2 lines of text for BROWSEINFO.lpszTitle and one line if
  2768.                                         // this flag is set.  Passing the message BFFM_SETSTATUSTEXTA to the hwnd can set the
  2769.                                         // rest of the text.  This is not used with BIF_USENEWUI and BROWSEINFO.lpszTitle gets
  2770.                                         // all three lines of text.
  2771. #define BIF_RETURNFSANCESTORS  0x0008
  2772. #define BIF_EDITBOX            0x0010   // Add an editbox to the dialog
  2773. #define BIF_VALIDATE           0x0020   // insist on valid result (or CANCEL)
  2774.  
  2775. #define BIF_NEWDIALOGSTYLE     0x0040   // Use the new dialog layout with the ability to resize
  2776.                                         // Caller needs to call OleInitialize() before using this API
  2777.  
  2778. #define BIF_USENEWUI           (BIF_NEWDIALOGSTYLE | BIF_EDITBOX)
  2779.  
  2780. #define BIF_BROWSEINCLUDEURLS  0x0080   // Allow URLs to be displayed or entered. (Requires BIF_USENEWUI)
  2781.  
  2782. #define BIF_BROWSEFORCOMPUTER  0x1000  // Browsing for Computers.
  2783. #define BIF_BROWSEFORPRINTER   0x2000  // Browsing for Printers
  2784. #define BIF_BROWSEINCLUDEFILES 0x4000  // Browsing for Everything
  2785. #define BIF_SHAREABLE          0x8000  // sharable resources displayed (remote shares, requires BIF_USENEWUI)
  2786.  
  2787. // message from browser
  2788. #define BFFM_INITIALIZED        1
  2789. #define BFFM_SELCHANGED         2
  2790. #define BFFM_VALIDATEFAILEDA    3   // lParam:szPath ret:1(cont),0(EndDialog)
  2791. #define BFFM_VALIDATEFAILEDW    4   // lParam:wzPath ret:1(cont),0(EndDialog)
  2792.  
  2793. // messages to browser
  2794. #define BFFM_SETSTATUSTEXTA     (WM_USER + 100)
  2795. #define BFFM_ENABLEOK           (WM_USER + 101)
  2796. #define BFFM_SETSELECTIONA      (WM_USER + 102)
  2797. #define BFFM_SETSELECTIONW      (WM_USER + 103)
  2798. #define BFFM_SETSTATUSTEXTW     (WM_USER + 104)
  2799.  
  2800. SHSTDAPI_(LPITEMIDLIST) SHBrowseForFolderA(LPBROWSEINFOA lpbi);
  2801. SHSTDAPI_(LPITEMIDLIST) SHBrowseForFolderW(LPBROWSEINFOW lpbi);
  2802.  
  2803. #ifdef UNICODE
  2804. #define SHBrowseForFolder   SHBrowseForFolderW
  2805. #define BFFM_SETSTATUSTEXT  BFFM_SETSTATUSTEXTW
  2806. #define BFFM_SETSELECTION   BFFM_SETSELECTIONW
  2807.  
  2808. #define BFFM_VALIDATEFAILED BFFM_VALIDATEFAILEDW
  2809. #else
  2810. #define SHBrowseForFolder   SHBrowseForFolderA
  2811. #define BFFM_SETSTATUSTEXT  BFFM_SETSTATUSTEXTA
  2812. #define BFFM_SETSELECTION   BFFM_SETSELECTIONA
  2813.  
  2814. #define BFFM_VALIDATEFAILED BFFM_VALIDATEFAILEDA
  2815. #endif
  2816.  
  2817. //-------------------------------------------------------------------------
  2818. //
  2819. // SHLoadInProc
  2820. //
  2821. //   When this function is called, the shell calls CoCreateInstance
  2822. //  (or equivalent) with CLSCTX_INPROC_SERVER and the specified CLSID
  2823. //  from within the shell's process and release it immediately.
  2824. //
  2825. //-------------------------------------------------------------------------
  2826.  
  2827. SHSTDAPI SHLoadInProc(REFCLSID rclsid);
  2828.  
  2829.  
  2830. //-------------------------------------------------------------------------
  2831. //
  2832. // IEnumIDList interface
  2833. //
  2834. //  IShellFolder::EnumObjects member returns an IEnumIDList object.
  2835. //
  2836. //-------------------------------------------------------------------------
  2837.  
  2838. typedef struct IEnumIDList      *LPENUMIDLIST;
  2839.  
  2840. #undef  INTERFACE
  2841. #define INTERFACE       IEnumIDList
  2842.  
  2843. DECLARE_INTERFACE_(IEnumIDList, IUnknown)
  2844. {
  2845.     // *** IUnknown methods ***
  2846.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
  2847.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  2848.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  2849.  
  2850.     // *** IEnumIDList methods ***
  2851.     STDMETHOD(Next)  (THIS_ ULONG celt,
  2852.                       LPITEMIDLIST *rgelt,
  2853.                       ULONG *pceltFetched) PURE;
  2854.     STDMETHOD(Skip)  (THIS_ ULONG celt) PURE;
  2855.     STDMETHOD(Reset) (THIS) PURE;
  2856.     STDMETHOD(Clone) (THIS_ IEnumIDList **ppenum) PURE;
  2857. };
  2858.  
  2859.  
  2860. //-------------------------------------------------------------------------
  2861. //
  2862. // IShellFolder interface
  2863. //
  2864. //
  2865. // [Member functions]
  2866. //
  2867. // IShellFolder::BindToObject(pidl, pbc, riid, ppv)
  2868. //   This function returns an instance of a sub-folder which is specified
  2869. //  by the IDList (pidl).
  2870. //
  2871. // IShellFolder::BindToStorage(pidl, pbc, riid, ppv)
  2872. //   This function returns a storage instance of a sub-folder which is
  2873. //  specified by the IDList (pidl). The shell never calls this member
  2874. //  function in the first release of Win95.
  2875. //
  2876. // IShellFolder::CompareIDs(lParam, pidl1, pidl2)
  2877. //   This function compares two IDLists and returns the result. The shell
  2878. //  explorer always passes 0 as lParam, which indicates "sort by name".
  2879. //  It should return 0 (as CODE of the scode), if two id indicates the
  2880. //  same object; negative value if pidl1 should be placed before pidl2;
  2881. //  positive value if pidl2 should be placed before pidl1.
  2882. //
  2883. // IShellFolder::CreateViewObject(hwndOwner, riid, ppv)
  2884. //   This function creates a view object of the folder itself. The view
  2885. //  object is a difference instance from the shell folder object.
  2886. //   "hwndOwner" can be used  as the owner window of its dialog box or
  2887. //  menu during the lifetime of the view object.
  2888. //  instance which has only one reference count. The explorer may create
  2889. //  more than one instances of view object from one shell folder object
  2890. //  and treat them as separate instances.
  2891. //
  2892. // IShellFolder::GetAttributesOf(cidl, apidl, prgfInOut)
  2893. //   This function returns the attributes of specified objects in that
  2894. //  folder. "cidl" and "apidl" specifies objects. "apidl" contains only
  2895. //  simple IDLists. The explorer initializes *prgfInOut with a set of
  2896. //  flags to be evaluated. The shell folder may optimize the operation
  2897. //  by not returning unspecified flags.
  2898. //
  2899. // IShellFolder::GetUIObjectOf(hwndOwner, cidl, apidl, riid, prgfInOut, ppv)
  2900. //   This function creates a UI object to be used for specified objects.
  2901. //  The shell explorer passes either IID_IDataObject (for transfer operation)
  2902. //  or IID_IContextMenu (for context menu operation) as riid.
  2903. //
  2904. // IShellFolder::GetDisplayNameOf
  2905. //   This function returns the display name of the specified object.
  2906. //  If the ID contains the display name (in the locale character set),
  2907. //  it returns the offset to the name. Otherwise, it returns a pointer
  2908. //  to the display name string (UNICODE), which is allocated by the
  2909. //  task allocator, or fills in a buffer.
  2910. //
  2911. // IShellFolder::SetNameOf
  2912. //   This function sets the display name of the specified object.
  2913. //  If it changes the ID as well, it returns the new ID which is
  2914. //  alocated by the task allocator.
  2915. //
  2916. //-------------------------------------------------------------------------
  2917.  
  2918. // IShellFolder::GetDisplayNameOf/SetNameOf uFlags
  2919. typedef enum tagSHGDN
  2920. {
  2921.     SHGDN_NORMAL             = 0x0000,  // default (display purpose)
  2922.     SHGDN_INFOLDER           = 0x0001,  // displayed under a folder (relative)
  2923.     SHGDN_FOREDITING         = 0x1000,  // for in-place editing
  2924.     SHGDN_FORADDRESSBAR      = 0x4000,  // UI friendly parsing name (remove ugly stuff)
  2925.     SHGDN_FORPARSING         = 0x8000,  // parsing name for ParseDisplayName()
  2926. } SHGNO;
  2927.  
  2928. // IShellFolder::EnumObjects grfFlags bits
  2929. typedef enum tagSHCONTF
  2930. {
  2931.     SHCONTF_FOLDERS             = 0x0020,   // only want folders enumerated (SHGAO_FOLDER)
  2932.     SHCONTF_NONFOLDERS          = 0x0040,   // include non folders
  2933.     SHCONTF_INCLUDEHIDDEN       = 0x0080,   // show items normally hidden
  2934.     SHCONTF_INIT_ON_FIRST_NEXT  = 0x0100,   // allow EnumObject() to return before validating enum
  2935.     SHCONTF_NETPRINTERSRCH      = 0x0200,   // hint that client is looking for printers
  2936.     SHCONTF_SHAREABLE           = 0x0400,   // hint that client is looking sharable resources (remote shares)
  2937. } SHCONTF;
  2938.  
  2939. // IShellFolder::CompareIDs lParam flags
  2940.  
  2941. #define SHCIDS_ALLFIELDS        0x80000000L
  2942. #define SHCIDS_COLUMNMASK       0x0000FFFFL
  2943.  
  2944. // IShellFolder::GetAttributesOf flags
  2945. // DESCRIPTION:
  2946. //      SFGAO_CANLINK: If this bit is set on an item in the shell folder, a
  2947. //            "Create Shortcut" menu item will be added to the File
  2948. //            menu and context menus for the item.  If the user selects
  2949. //            that command, your IContextMenu::InvokeCommand() will be called
  2950. //            with 'link'.
  2951. //                 That flag will also be used to determine if "Create Shortcut"
  2952. //            should be added when the item in your folder is dragged to another
  2953. //            folder.
  2954. #define SFGAO_CANCOPY           DROPEFFECT_COPY // Objects can be copied    (0x1)
  2955. #define SFGAO_CANMOVE           DROPEFFECT_MOVE // Objects can be moved     (0x2)
  2956. #define SFGAO_CANLINK           DROPEFFECT_LINK // Objects can be linked    (0x4)
  2957. #define SFGAO_CANRENAME         0x00000010L     // Objects can be renamed
  2958. #define SFGAO_CANDELETE         0x00000020L     // Objects can be deleted
  2959. #define SFGAO_HASPROPSHEET      0x00000040L     // Objects have property sheets
  2960. #define SFGAO_DROPTARGET        0x00000100L     // Objects are drop target
  2961. #define SFGAO_CAPABILITYMASK    0x00000177L
  2962. #define SFGAO_LINK              0x00010000L     // Shortcut (link)
  2963. #define SFGAO_SHARE             0x00020000L     // shared
  2964. #define SFGAO_READONLY          0x00040000L     // read-only
  2965. #define SFGAO_GHOSTED           0x00080000L     // ghosted icon
  2966. #define SFGAO_HIDDEN            0x00080000L     // hidden object
  2967. #define SFGAO_DISPLAYATTRMASK   0x000F0000L
  2968. #define SFGAO_FILESYSANCESTOR   0x10000000L     // It contains file system folder
  2969. #define SFGAO_FOLDER            0x20000000L     // It's a folder.
  2970. #define SFGAO_FILESYSTEM        0x40000000L     // is a file system thing (file/folder/root)
  2971. #define SFGAO_HASSUBFOLDER      0x80000000L     // Expandable in the map pane
  2972. #define SFGAO_CONTENTSMASK      0x80000000L
  2973. #define SFGAO_VALIDATE          0x01000000L     // invalidate cached information
  2974. #define SFGAO_REMOVABLE         0x02000000L     // is this removeable media?
  2975. #define SFGAO_COMPRESSED        0x04000000L     // Object is compressed (use alt color)
  2976. #define SFGAO_BROWSABLE         0x08000000L     // is in-place browsable
  2977. #define SFGAO_NONENUMERATED     0x00100000L     // is a non-enumerated object
  2978. #define SFGAO_NEWCONTENT        0x00200000L     // should show bold in explorer tree
  2979. #define SFGAO_CANMONIKER        0x00400000L     // can create monikers for its objects
  2980.  
  2981.  
  2982. // IShellFolder IBindCtx* parameters. the IUnknown for these are
  2983. // accessed through IBindCtx::RegisterObjectParam/GetObjectParam
  2984.  
  2985. // this object will support IPersist to query a CLSID that should be skipped
  2986. // in the binding process. this is to avoid loops or to allow delegation to
  2987. // base name space functionality. see SHSkipJunction()
  2988.  
  2989. #define STR_SKIP_BINDING_CLSID      L"Skip Binding CLSID"
  2990.  
  2991. #undef  INTERFACE
  2992. #define INTERFACE       IShellFolder
  2993.  
  2994. DECLARE_INTERFACE_(IShellFolder, IUnknown)
  2995. {
  2996.     // *** IUnknown methods ***
  2997.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
  2998.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  2999.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  3000.  
  3001.     // *** IShellFolder methods ***
  3002.     STDMETHOD(ParseDisplayName)(THIS_ HWND hwnd, LPBC pbc, LPOLESTR pszDisplayName,
  3003.                                 ULONG *pchEaten, LPITEMIDLIST *ppidl, ULONG *pdwAttributes) PURE;
  3004.  
  3005.     STDMETHOD(EnumObjects)(THIS_ HWND hwnd, DWORD grfFlags, IEnumIDList **ppenumIDList) PURE;
  3006.  
  3007.     STDMETHOD(BindToObject)(THIS_ LPCITEMIDLIST pidl, LPBC pbc, REFIID riid, void **ppv) PURE;
  3008.     STDMETHOD(BindToStorage)(THIS_ LPCITEMIDLIST pidl, LPBC pbc, REFIID riid, void **ppv) PURE;
  3009.     STDMETHOD(CompareIDs)(THIS_ LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2) PURE;
  3010.     STDMETHOD(CreateViewObject)(THIS_ HWND hwndOwner, REFIID riid, void **ppv) PURE;
  3011.     STDMETHOD(GetAttributesOf)(THIS_ UINT cidl, LPCITEMIDLIST * apidl, ULONG * rgfInOut) PURE;
  3012.     STDMETHOD(GetUIObjectOf)(THIS_ HWND hwndOwner, UINT cidl, LPCITEMIDLIST * apidl,
  3013.                              REFIID riid, UINT * prgfInOut, void **ppv) PURE;
  3014.     STDMETHOD(GetDisplayNameOf)(THIS_ LPCITEMIDLIST pidl, DWORD uFlags, LPSTRRET lpName) PURE;
  3015.     STDMETHOD(SetNameOf)(THIS_ HWND hwnd, LPCITEMIDLIST pidl, LPCOLESTR pszName,
  3016.                          DWORD uFlags, LPITEMIDLIST *ppidlOut) PURE;
  3017. };
  3018.  
  3019. typedef IShellFolder * LPSHELLFOLDER;
  3020.  
  3021. //
  3022. //  Helper function which returns a IShellFolder interface to the desktop
  3023. // folder. This is equivalent to call CoCreateInstance with CLSID_ShellDesktop.
  3024. //
  3025. //  CoCreateInstance(CLSID_Desktop, NULL,
  3026. //                   CLSCTX_INPROC, IID_IShellFolder, &pshf);
  3027. //
  3028. SHSTDAPI SHGetDesktopFolder(IShellFolder **ppshf);
  3029.  
  3030.  
  3031. // IShellFolder IBindCtx* parameters. the IUnknown for these are
  3032. // accessed through IBindCtx::RegisterObjectParam/GetObjectParam
  3033. // use this to provide the data needed create IDLists through
  3034. // IShellFolder::ParseDisplayName(). this data applies to the last element
  3035. // of the name that is parsed (c:\foo\bar.txt, data applies to bar.txt)
  3036. // this makes creating these IDLists much faster that suppling the name only
  3037.  
  3038. #define STR_FILE_SYS_BIND_DATA      L"File System Bind Data"
  3039.  
  3040. #undef  INTERFACE
  3041. #define INTERFACE   IFileSystemBindData
  3042.  
  3043. DECLARE_INTERFACE_(IFileSystemBindData, IUnknown)
  3044. {
  3045.     // *** IUnknown methods ***
  3046.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
  3047.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  3048.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  3049.  
  3050.     // *** IFileSystemBindData methods ***
  3051.     STDMETHOD(SetFindData)(THIS_ const WIN32_FIND_DATAW *pfd) PURE;
  3052.     STDMETHOD(GetFindData)(THIS_ WIN32_FIND_DATAW *pfd) PURE;
  3053. };
  3054.  
  3055.  
  3056. typedef struct _SHELLDETAILS
  3057. {
  3058.     int     fmt;            // LVCFMT_* value (header only)
  3059.     int     cxChar;         // Number of "average" characters (header only)
  3060.     STRRET  str;            // String information
  3061. } SHELLDETAILS, *LPSHELLDETAILS;
  3062.  
  3063. #undef  INTERFACE
  3064. #define INTERFACE   IShellDetails
  3065.  
  3066. DECLARE_INTERFACE_(IShellDetails, IUnknown)
  3067. {
  3068.     // *** IUnknown methods ***
  3069.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
  3070.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  3071.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  3072.  
  3073.     // *** IShellDetails methods ***
  3074.     STDMETHOD(GetDetailsOf)(THIS_ LPCITEMIDLIST pidl, UINT iColumn, SHELLDETAILS *pDetails) PURE;
  3075.     STDMETHOD(ColumnClick)(THIS_ UINT iColumn) PURE;
  3076. };
  3077.  
  3078.  
  3079. #if (_WIN32_IE >= 0x0500)
  3080.  
  3081. //-------------------------------------------------------------------------
  3082. //
  3083. // IEnumExtraSearch interface
  3084. //
  3085. //  IShellFolder2::EnumSearches member returns an IEnumExtraSearch object.
  3086. //
  3087. //-------------------------------------------------------------------------
  3088.  
  3089. typedef struct tagEXTRASEARCH
  3090. {
  3091.     GUID    guidSearch;
  3092.     WCHAR   wszFriendlyName[80];
  3093.     WCHAR   wszUrl[2084];
  3094. }EXTRASEARCH, *LPEXTRASEARCH;
  3095.  
  3096. typedef struct IEnumExtraSearch *LPENUMEXTRASEARCH;
  3097.  
  3098. #undef  INTERFACE
  3099. #define INTERFACE       IEnumExtraSearch
  3100.  
  3101. DECLARE_INTERFACE_(IEnumExtraSearch, IUnknown)
  3102. {
  3103.     // *** IUnknown methods ***
  3104.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
  3105.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  3106.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  3107.  
  3108.     // *** IEnumExtraSearch methods ***
  3109.     STDMETHOD(Next)  (THIS_ ULONG celt, EXTRASEARCH *rgelt, ULONG *pceltFetched) PURE;
  3110.     STDMETHOD(Skip)  (THIS_ ULONG celt) PURE;
  3111.     STDMETHOD(Reset) (THIS) PURE;
  3112.     STDMETHOD(Clone) (THIS_ IEnumExtraSearch **ppenum) PURE;
  3113. };
  3114.  
  3115. //--------------------------------------------------------------------------
  3116. // IShellFolder2
  3117. //
  3118. // [member functions]
  3119. //
  3120. // IShellFolder2::GetDefaultSearchGUID(LPGUID pGuid)
  3121. //   Returns the guid of the search that is to be invoked when user clicks
  3122. //   on the search toolbar button
  3123. //
  3124. // IShellFolder2::EnumSearches(IEnumExtraSearch **ppenum)
  3125. //   gives an enumerator of the searches to be added to the search menu
  3126. //--------------------------------------------------------------------------
  3127.  
  3128. // IShellFolder2::GetDefaultColumnState values
  3129. typedef enum {
  3130.     SHCOLSTATE_TYPE_STR     = 0x00000001,
  3131.     SHCOLSTATE_TYPE_INT     = 0x00000002,
  3132.     SHCOLSTATE_TYPE_DATE    = 0x00000003,
  3133.     SHCOLSTATE_TYPEMASK     = 0x0000000F,
  3134.     SHCOLSTATE_ONBYDEFAULT  = 0x00000010,   // should on by default in details view
  3135.     SHCOLSTATE_SLOW         = 0x00000020,   // will be slow to compute, do on a background thread
  3136.     SHCOLSTATE_EXTENDED     = 0x00000040,   // provided by a handler, not the folder
  3137.     SHCOLSTATE_SECONDARYUI  = 0x00000080,   // not displayed in context menu, but listed in the "More..." dialog
  3138.     SHCOLSTATE_HIDDEN       = 0x00000100,   // not displayed in the UI
  3139. } SHCOLSTATE;
  3140.  
  3141. typedef struct {
  3142.     GUID fmtid;
  3143.     DWORD pid;
  3144. } SHCOLUMNID, *LPSHCOLUMNID;
  3145. typedef const SHCOLUMNID* LPCSHCOLUMNID;
  3146.  
  3147. #undef  INTERFACE
  3148. #define INTERFACE       IShellFolder2
  3149.  
  3150. DECLARE_INTERFACE_(IShellFolder2, IShellFolder)
  3151. {
  3152.     // *** IUnknown methods ***
  3153.     STDMETHOD(QueryInterface)(THIS_ REFIID riid, void **ppv) PURE;
  3154.     STDMETHOD_(ULONG,AddRef)(THIS)  PURE;
  3155.     STDMETHOD_(ULONG,Release)(THIS) PURE;
  3156.  
  3157.     // *** IShellFolder methods ***
  3158.     STDMETHOD(ParseDisplayName)(THIS_ HWND hwnd, LPBC pbc, LPOLESTR pszDisplayName,
  3159.                                 ULONG *pchEaten, LPITEMIDLIST *ppidl, ULONG *pdwAttributes) PURE;
  3160.     STDMETHOD(EnumObjects)(THIS_ HWND hwnd, DWORD grfFlags, IEnumIDList **ppenumIDList) PURE;
  3161.     STDMETHOD(BindToObject)(THIS_ LPCITEMIDLIST pidl, LPBC pbc, REFIID riid, void **ppv) PURE;
  3162.     STDMETHOD(BindToStorage)(THIS_ LPCITEMIDLIST pidl, LPBC pbc, REFIID riid, void **ppv) PURE;
  3163.     STDMETHOD(CompareIDs)(THIS_ LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2) PURE;
  3164.     STDMETHOD(CreateViewObject)(THIS_ HWND hwnd, REFIID riid, void **ppv) PURE;
  3165.     STDMETHOD(GetAttributesOf)(THIS_ UINT cidl, LPCITEMIDLIST * apidl, ULONG * drgfInOut) PURE;
  3166.     STDMETHOD(GetUIObjectOf)(THIS_ HWND hwnd, UINT cidl, LPCITEMIDLIST * apidl,
  3167.                              REFIID riid, UINT * prgfInOut, void **ppv) PURE;
  3168.     STDMETHOD(GetDisplayNameOf)(THIS_ LPCITEMIDLIST pidl, DWORD uFlags, STRRET *psr) PURE;
  3169.     STDMETHOD(SetNameOf)(THIS_ HWND hwnd, LPCITEMIDLIST pidl, LPCOLESTR pszName,
  3170.                          DWORD uFlags, LPITEMIDLIST *ppidl) PURE;
  3171.  
  3172.     // *** IShellFolder2 methods ***
  3173.     STDMETHOD(GetDefaultSearchGUID)(THIS_ GUID *pguid) PURE;
  3174.     STDMETHOD(EnumSearches)(THIS_ IEnumExtraSearch **ppenum) PURE;
  3175.     STDMETHOD(GetDefaultColumn) (THIS_ DWORD dwRes, ULONG *pSort, ULONG *pDisplay) PURE;
  3176.     STDMETHOD(GetDefaultColumnState)(THIS_ UINT iColumn, DWORD *pcsFlags) PURE;
  3177.     STDMETHOD(GetDetailsEx)(THIS_ LPCITEMIDLIST pidl, const SHCOLUMNID *pscid, VARIANT *pv) PURE;
  3178.     STDMETHOD(GetDetailsOf)(THIS_ LPCITEMIDLIST pidl, UINT iColumn, SHELLDETAILS *psd) PURE;
  3179.     STDMETHOD(MapColumnToSCID)(THIS_ UINT iColumn, SHCOLUMNID *pscid) PURE;
  3180. };
  3181.  
  3182. #endif
  3183.  
  3184.  
  3185.  
  3186. //-------------------------------------------------------------------------
  3187. //
  3188. // ITaskbarList interface
  3189. //
  3190. //
  3191. // [Member functions]
  3192. //
  3193. // ITaskbarList::HrInit()
  3194. //   This function must be called first to validate use of other members.
  3195. //
  3196. // ITaskbarList::AddTab(hwnd)
  3197. //   This function adds a tab for hwnd to the taskbar.
  3198. //
  3199. // ITaskbarList::DeleteTab(hwnd)
  3200. //   This function deletes a tab for hwnd from the taskbar.
  3201. //
  3202. // ITaskbarList::ActivateTab(hwnd)
  3203. //   This function activates the tab associated with hwnd on the taskbar.
  3204. //
  3205. // ITaskbarList::SetActivateAlt(hwnd)
  3206. //   This function marks hwnd in the taskbar as the active tab
  3207. //
  3208. //-------------------------------------------------------------------------
  3209.  
  3210. #undef INTERFACE
  3211. #define INTERFACE ITaskbarList
  3212.  
  3213. DECLARE_INTERFACE_(ITaskbarList, IUnknown)
  3214. {
  3215.     // *** IUnknown methods ***
  3216.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
  3217.     STDMETHOD_(ULONG, AddRef) (THIS) PURE;
  3218.     STDMETHOD_(ULONG, Release) (THIS) PURE;
  3219.  
  3220.     // *** ITaskbarList specific methods ***
  3221.     STDMETHOD(HrInit) (THIS) PURE;
  3222.     STDMETHOD(AddTab) (THIS_ HWND hwnd) PURE;
  3223.     STDMETHOD(DeleteTab) (THIS_ HWND hwnd) PURE;
  3224.     STDMETHOD(ActivateTab) (THIS_ HWND hwnd) PURE;
  3225.     STDMETHOD(SetActiveAlt) (THIS_ HWND hwnd) PURE;
  3226. };
  3227.  
  3228. //-------------------------------------------------------------------------
  3229. //
  3230. // IObjMgr interface
  3231. //
  3232. //
  3233. // [Member functions]
  3234. //
  3235. // IObjMgr::Append(punk)
  3236. //   This function adds an object to the end of a list of objects.
  3237. //
  3238. // IObjMgr::Remove(punk)
  3239. //   This function removes an object from a list of objects.
  3240. //
  3241. // This is implemented by CLSID_ACLMulti so each AutoComplete List
  3242. // (CLSID_ACLHistory, CLSID_ACListISF, CLSID_ACLMRU) can be added.
  3243. // CLSID_ACLMulti's IEnumString will then be the union of the results
  3244. // from the COM Objects added.
  3245. //-------------------------------------------------------------------------
  3246.  
  3247. #undef INTERFACE
  3248. #define INTERFACE IObjMgr
  3249.  
  3250. DECLARE_INTERFACE_(IObjMgr, IUnknown)
  3251. {
  3252.     // *** IUnknown methods ***
  3253.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
  3254.     STDMETHOD_(ULONG, AddRef) (THIS) PURE;
  3255.     STDMETHOD_(ULONG, Release) (THIS) PURE;
  3256.  
  3257.     // *** IObjMgr specific methods ***
  3258.     STDMETHOD(Append) (THIS_ IUnknown *punk) PURE;
  3259.     STDMETHOD(Remove) (THIS_ IUnknown *punk) PURE;
  3260. };
  3261.  
  3262.  
  3263. //-------------------------------------------------------------------------
  3264. //
  3265. // ICurrentWorkingDirectory interface
  3266. //
  3267. //
  3268. // [Member functions]
  3269. //
  3270. // ICurrentWorkingDirectory::GetDirectory(LPWSTR pwzPath, DWORD cchSize)
  3271. //   This function gets the Current Working Directory from a COM object that
  3272. //   stores such state.
  3273. //
  3274. // ICurrentWorkingDirectory::SetDirectory(LPCWSTR pwzPath)
  3275. //   This function sets the Current Working Directory of a COM object that
  3276. //   stores such state.
  3277. //
  3278. // This function can be used generically.  One COM object that implements it
  3279. // is CLSID_ACListISF so that the AutoComplete engine can complete relative
  3280. // paths.  SetDirectory() will set the "Current Working Directory" and
  3281. // AutoComplete with then complete both absolute and relative paths.
  3282. // For Example, if ::SetDirectory(L"C:\Program Files") is called, then
  3283. // the user can AutoComplete "..\winnt".  In order to set the current
  3284. // working directory for non-file system paths, "ftp://ftp.microsoft.com/" or
  3285. // "Control Panel" for example, use IPersistFolder.
  3286. //-------------------------------------------------------------------------
  3287.  
  3288. #undef INTERFACE
  3289. #define INTERFACE ICurrentWorkingDirectory
  3290.  
  3291. DECLARE_INTERFACE_(ICurrentWorkingDirectory, IUnknown)
  3292. {
  3293.     // *** IUnknown methods ***
  3294.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
  3295.     STDMETHOD_(ULONG, AddRef) (THIS) PURE;
  3296.     STDMETHOD_(ULONG, Release) (THIS) PURE;
  3297.  
  3298.     // *** ICurrentWorkingDirectory specific methods ***
  3299.     STDMETHOD(GetDirectory) (THIS_ LPWSTR pwzPath, DWORD cchSize) PURE;
  3300.     STDMETHOD(SetDirectory) (THIS_ LPCWSTR pwzPath) PURE;
  3301. };
  3302.  
  3303.  
  3304. //-------------------------------------------------------------------------
  3305. //
  3306. // IACList interface
  3307. //
  3308. //
  3309. // [Member functions]
  3310. //
  3311. // IObjMgr::Expand(LPCOLESTR)
  3312. //   This function tells an autocomplete list to expand a specific string.
  3313. //
  3314. // If the user enters a multi-level path, AutoComplete (CLSID_AutoComplete)
  3315. // will use this interface to tell the "AutoComplete Lists" where to expand
  3316. // the results.
  3317. //
  3318. // For Example, if the user enters "C:\Program Files\Micros", AutoComplete
  3319. // first completely enumerate the "AutoComplete Lists" via IEnumString.  Then it
  3320. // will call the "AutoComplete Lists" with IACList::Expand(L"C:\Program Files").
  3321. // It will then enumerate the IEnumString interface again to get results in
  3322. // that directory.
  3323. //-------------------------------------------------------------------------
  3324.  
  3325. #undef INTERFACE
  3326. #define INTERFACE IACList
  3327.  
  3328. DECLARE_INTERFACE_(IACList, IUnknown)
  3329. {
  3330.     // *** IUnknown methods ***
  3331.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
  3332.     STDMETHOD_(ULONG, AddRef) (THIS) PURE;
  3333.     STDMETHOD_(ULONG, Release) (THIS) PURE;
  3334.  
  3335.     // *** IACList specific methods ***
  3336.     STDMETHOD(Expand) (THIS_ LPCOLESTR pszExpand) PURE;
  3337. };
  3338.  
  3339. //-------------------------------------------------------------------------
  3340. //
  3341. // IACList2 interface
  3342. //
  3343. // [Description]
  3344. //        This interface exists to allow the caller to set filter criteria
  3345. // for an AutoComplete List.  AutoComplete Lists generates the list of
  3346. // possible AutoComplete completions.  CLSID_ACListISF is one AutoComplete
  3347. // List COM object that implements this interface.
  3348. //-------------------------------------------------------------------------
  3349.  
  3350. #undef INTERFACE
  3351. #define INTERFACE IACList2
  3352.  
  3353. typedef enum _tagAUTOCOMPLETELISTOPTIONS
  3354. {
  3355.     ACLO_NONE            = 0,    // don't enumerate anything
  3356.     ACLO_CURRENTDIR      = 1,    // enumerate current directory
  3357.     ACLO_MYCOMPUTER      = 2,    // enumerate MyComputer
  3358.     ACLO_DESKTOP         = 4,    // enumerate Desktop Folder
  3359.     ACLO_FAVORITES       = 8,    // enumerate Favorites Folder
  3360.     ACLO_FILESYSONLY     = 16,   // enumerate only the file system
  3361. } AUTOCOMPLETELISTOPTIONS;
  3362.  
  3363. DECLARE_INTERFACE_(IACList2, IACList)
  3364. {
  3365.     // *** IACList2 specific methods ***
  3366.     STDMETHOD(SetOptions)(THIS_ DWORD dwFlag) PURE;
  3367.     STDMETHOD(GetOptions)(THIS_ DWORD* pdwFlag) PURE;
  3368. };
  3369.  
  3370.  
  3371. /*-------------------------------------------------------------------------*\
  3372.     INTERFACE: IProgressDialog
  3373.  
  3374.     DESCRIPTION:
  3375.         CLSID_ProgressDialog/IProgressDialog exist to allow a caller to create
  3376.     a progress dialog, set it's title, animation, text lines, progress, and
  3377.     it will do all the work of updating on a background thread, being modless,
  3378.     handling the user cancelling the operation, and estimating the time remaining
  3379.     until the operation completes.
  3380.  
  3381.     USAGE:
  3382.         This is how the dialog is used during operations that require progress
  3383.     and the ability to cancel:
  3384.     {
  3385.         DWORD dwComplete, dwTotal;
  3386.         IProgressDialog * ppd;
  3387.         CoCreateInstance(CLSID_ProgressDialog, NULL, CLSCTX_INPROC_SERVER, IID_IProgressDialog, (void **)&ppd);
  3388.         ppd->SetTitle(L"My Slow Operation");                                // Set the title of the dialog.
  3389.         ppd->SetAnimation(hInstApp, IDA_OPERATION_ANIMATION);               // Set the animation to play.
  3390.         ppd->StartProgressDialog(hwndParent, punk, PROGDLG_AUTOTIME, NULL); // Display and enable automatic estimated time remaining.
  3391.         ppd->SetCancelMsg(L"Please wait while the current operation is cleaned up", NULL);   // Will only be displayed if Cancel button is pressed.
  3392.  
  3393.         dwComplete = 0;
  3394.         dwTotal = CalcTotalUnitsToDo();
  3395.  
  3396.         // Reset because CalcTotalUnitsToDo() took a long time and the estimated time
  3397.         // is based on the time between ::StartProgressDialog() and the first
  3398.         // ::SetProgress() call.
  3399.         ppd->Timer(PDTIMER_RESET, NULL);
  3400.  
  3401.         for (nIndex = 0; nIndex < nTotal; nIndex++)
  3402.         {
  3403.             if (TRUE == ppd->HasUserCancelled())
  3404.                 break;
  3405.  
  3406.             ppd->SetLine(2, L"I'm processing item n", FALSE, NULL);
  3407.             dwComplete += DoSlowOperation();
  3408.  
  3409.             ppd->SetProgress(dwCompleted, dwTotal);
  3410.         }
  3411.  
  3412.         ppd->StopProgressDialog();
  3413.         ppd->Release();
  3414.     }
  3415. \*-------------------------------------------------------------------------*/
  3416.  
  3417. // Flags for IProgressDialog::StartProgressDialog() (dwFlags)
  3418. #define PROGDLG_NORMAL          0x00000000      // default normal progress dlg behavior
  3419. #define PROGDLG_MODAL           0x00000001      // the dialog is modal to its hwndParent (default is modeless)
  3420. #define PROGDLG_AUTOTIME        0x00000002      // automatically updates the "Line3" text with the "time remaining" (you cant call SetLine3 if you passs this!)
  3421. #define PROGDLG_NOTIME          0x00000004      // we dont show the "time remaining" if this is set. We need this if dwTotal < dwCompleted for sparse files
  3422. #define PROGDLG_NOMINIMIZE      0x00000008      // Do not have a minimize button in the caption bar.
  3423. #define PROGDLG_NOPROGRESSBAR   0x00000010      // Don't display the progress bar
  3424.  
  3425. // Time Actions (dwTimerAction)
  3426. #define PDTIMER_RESET       0x00000001       // Reset the timer so the progress will be calculated from now until the first ::SetProgress() is called so
  3427.                                              // those this time will correspond to the values passed to ::SetProgress().  Only do this before ::SetProgress() is called.
  3428.  
  3429.  
  3430. #undef  INTERFACE
  3431. #define INTERFACE   IProgressDialog
  3432.  
  3433. DECLARE_INTERFACE_(IProgressDialog, IUnknown)
  3434. {
  3435.     // *** IUnknown methods ***
  3436.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
  3437.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  3438.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  3439.  
  3440.     // *** IProgressDialog specific methods
  3441.     STDMETHOD(StartProgressDialog)(THIS_ HWND hwndParent, IUnknown * punkEnableModless, DWORD dwFlags, LPCVOID pvResevered) PURE;
  3442.     STDMETHOD(StopProgressDialog)(THIS) PURE;
  3443.     STDMETHOD(SetTitle)(THIS_ LPCWSTR pwzTitle) PURE;
  3444.     STDMETHOD(SetAnimation)(THIS_ HINSTANCE hInstAnimation, UINT idAnimation) PURE;
  3445.     STDMETHOD_(BOOL,HasUserCancelled) (THIS) PURE;
  3446.     STDMETHOD(SetProgress)(THIS_ DWORD dwCompleted, DWORD dwTotal) PURE;
  3447.     STDMETHOD(SetProgress64)(THIS_ ULONGLONG ullCompleted, ULONGLONG ullTotal) PURE;
  3448.     STDMETHOD(SetLine)(THIS_ DWORD dwLineNum, LPCWSTR pwzString, BOOL fCompactPath, LPCVOID pvResevered) PURE;
  3449.     STDMETHOD(SetCancelMsg)(THIS_ LPCWSTR pwzCancelMsg, LPCVOID pvResevered) PURE;
  3450.     STDMETHOD(Timer)(THIS_ DWORD dwTimerAction, LPCVOID pvResevered) PURE;
  3451. };
  3452.  
  3453.  
  3454. //==========================================================================
  3455. // IInputObjectSite/IInputObject interfaces
  3456. //
  3457. //  These interfaces allow us (or ISVs) to install/update external Internet
  3458. // Toolbar for IE and the shell. The frame will simply get the CLSID from
  3459. // registry (to be defined) and CoCreateInstance it.
  3460. //
  3461. //==========================================================================
  3462.  
  3463. //-------------------------------------------------------------------------
  3464. //
  3465. // IInputObjectSite interface
  3466. //
  3467. //   A site implements this interface so the object can communicate
  3468. // focus change to it.
  3469. //
  3470. // [Member functions]
  3471. //
  3472. // IInputObjectSite::OnFocusChangeIS(punkObj, fSetFocus)
  3473. //   Object (punkObj) is getting or losing the focus.
  3474. //
  3475. //-------------------------------------------------------------------------
  3476.  
  3477.  
  3478. #undef  INTERFACE
  3479. #define INTERFACE   IInputObjectSite
  3480.  
  3481. DECLARE_INTERFACE_(IInputObjectSite, IUnknown)
  3482. {
  3483.     // *** IUnknown methods ***
  3484.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
  3485.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  3486.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  3487.  
  3488.     // *** IInputObjectSite specific methods ***
  3489.     STDMETHOD(OnFocusChangeIS)(THIS_ IUnknown* punkObj, BOOL fSetFocus) PURE;
  3490. };
  3491.  
  3492.  
  3493. //-------------------------------------------------------------------------
  3494. //
  3495. // IInputObject interface
  3496. //
  3497. //   An object implements this interface so the site can communicate
  3498. // activation and accelerator events to it.
  3499. //
  3500. // [Member functions]
  3501. //
  3502. // IInputObject::UIActivateIO(fActivate, lpMsg)
  3503. //   Activates or deactivates the object.  lpMsg may be NULL.  Returns
  3504. //   S_OK if the activation succeeded.
  3505. //
  3506. // IInputObject::HasFocusIO()
  3507. //   Returns S_OK if the object has the focus, S_FALSE if not.
  3508. //
  3509. // IInputObject::TranslateAcceleratorIO(lpMsg)
  3510. //   Allow the object to process the message.  Returns S_OK if the
  3511. //   message was processed (eaten).
  3512. //
  3513. //-------------------------------------------------------------------------
  3514.  
  3515.  
  3516. #undef  INTERFACE
  3517. #define INTERFACE   IInputObject
  3518.  
  3519. DECLARE_INTERFACE_(IInputObject, IUnknown)
  3520. {
  3521.     // *** IUnknown methods ***
  3522.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
  3523.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  3524.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  3525.  
  3526.     // *** IInputObject specific methods ***
  3527.     STDMETHOD(UIActivateIO)(THIS_ BOOL fActivate, LPMSG lpMsg) PURE;
  3528.     STDMETHOD(HasFocusIO)(THIS) PURE;
  3529.     STDMETHOD(TranslateAcceleratorIO)(THIS_ LPMSG lpMsg) PURE;
  3530. };
  3531.  
  3532.  
  3533. //==========================================================================
  3534. // IDockingWindowSite/IDockingWindow/IDockingWindowFrame interfaces
  3535. // IInputObjectSite/IInputObject interfaces
  3536. //
  3537. //  These interfaces allow us (or ISVs) to install/update external Internet
  3538. // Toolbar for IE and the shell. The frame will simply get the CLSID from
  3539. // registry (to be defined) and CoCreateInstance it.
  3540. //
  3541. //==========================================================================
  3542.  
  3543.  
  3544. //-------------------------------------------------------------------------
  3545. //
  3546. // IDockingWindowSite interface
  3547. //
  3548. //   A site implements this interface so the object can negotiate for
  3549. // and inquire about real estate on the site.
  3550. //
  3551. // [Member functions]
  3552. //
  3553. // IDockingWindowSite::GetBorderDW(punkObj, prcBorder)
  3554. //   Site returns the bounding rectangle of the given source object
  3555. //   (punkObj).
  3556. //
  3557. // IDockingWindowSite::RequestBorderSpaceDW(punkObj, pbw)
  3558. //   Object requests that the site makes room for it, as specified in
  3559. //   *pbw.
  3560. //
  3561. // IDockingWindowSite::SetBorderSpaceDW(punkObj, pbw)
  3562. //   Object requests that the site set the border spacing to the size
  3563. //   specified in *pbw.
  3564. //
  3565. //-------------------------------------------------------------------------
  3566.  
  3567.  
  3568. #undef  INTERFACE
  3569. #define INTERFACE   IDockingWindowSite
  3570.  
  3571. DECLARE_INTERFACE_(IDockingWindowSite, IOleWindow)
  3572. {
  3573.     // *** IUnknown methods ***
  3574.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
  3575.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  3576.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  3577.  
  3578.     // *** IOleWindow methods ***
  3579.     STDMETHOD(GetWindow) (THIS_ HWND * lphwnd) PURE;
  3580.     STDMETHOD(ContextSensitiveHelp) (THIS_ BOOL fEnterMode) PURE;
  3581.  
  3582.     // *** IDockingWindowSite methods ***
  3583.     STDMETHOD(GetBorderDW) (THIS_ IUnknown* punkObj, LPRECT prcBorder) PURE;
  3584.     STDMETHOD(RequestBorderSpaceDW) (THIS_ IUnknown* punkObj, LPCBORDERWIDTHS pbw) PURE;
  3585.     STDMETHOD(SetBorderSpaceDW) (THIS_ IUnknown* punkObj, LPCBORDERWIDTHS pbw) PURE;
  3586. };
  3587.  
  3588.  
  3589.  
  3590. //-------------------------------------------------------------------------
  3591. //
  3592. // IDockingWindowFrame interface
  3593. //
  3594. //
  3595. // [Member functions]
  3596. //
  3597. // IDockingWindowFrame::AddToolbar(punkSrc, pwszItem, dwReserved)
  3598. //
  3599. // IDockingWindowFrame::RemoveToolbar(punkSrc, dwRemoveFlags)
  3600. //
  3601. // IDockingWindowFrame::FindToolbar(pwszItem, riid, ppv)
  3602. //
  3603. //-------------------------------------------------------------------------
  3604.  
  3605.  
  3606. // flags for RemoveToolbar
  3607. #define DWFRF_NORMAL            0x0000
  3608. #define DWFRF_DELETECONFIGDATA  0x0001
  3609.  
  3610.  
  3611. // flags for AddToolbar
  3612. #define DWFAF_HIDDEN  0x0001   // add hidden
  3613.  
  3614. #undef  INTERFACE
  3615. #define INTERFACE   IDockingWindowFrame
  3616.  
  3617. DECLARE_INTERFACE_(IDockingWindowFrame, IOleWindow)
  3618. {
  3619.     // *** IUnknown methods ***
  3620.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
  3621.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  3622.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  3623.  
  3624.     // *** IOleWindow methods ***
  3625.     STDMETHOD(GetWindow) (THIS_ HWND * lphwnd) PURE;
  3626.     STDMETHOD(ContextSensitiveHelp) (THIS_ BOOL fEnterMode) PURE;
  3627.  
  3628.     // *** IDockingWindowFrame methods ***
  3629.     STDMETHOD(AddToolbar) (THIS_ IUnknown* punkSrc, LPCWSTR pwszItem, DWORD dwAddFlags) PURE;
  3630.     STDMETHOD(RemoveToolbar) (THIS_ IUnknown* punkSrc, DWORD dwRemoveFlags) PURE;
  3631.     STDMETHOD(FindToolbar) (THIS_ LPCWSTR pwszItem, REFIID riid, void **ppv) PURE;
  3632. };
  3633.  
  3634.  
  3635.  
  3636. //-------------------------------------------------------------------------
  3637. //
  3638. // IDockingWindow interface
  3639. //
  3640. //   An object (docking window) implements this interface so the site can
  3641. // communicate with it.  An example of a docking window is a toolbar.
  3642. //
  3643. // [Member functions]
  3644. //
  3645. // IDockingWindow::ShowDW(fShow)
  3646. //   Shows or hides the docking window.
  3647. //
  3648. // IDockingWindow::CloseDW(dwReserved)
  3649. //   Closes the docking window.  dwReserved must be 0.
  3650. //
  3651. // IDockingWindow::ResizeBorderDW(prcBorder, punkToolbarSite, fReserved)
  3652. //   Resizes the docking window's border to *prcBorder.  fReserved must
  3653. //   be 0.
  3654. // IObjectWithSite::SetSite(punkSite)
  3655. //   IDockingWindow usually paired with IObjectWithSite.
  3656. //   Provides the IUnknown pointer of the site to the docking window.
  3657. //
  3658. //
  3659. //-------------------------------------------------------------------------
  3660.  
  3661.  
  3662. #undef  INTERFACE
  3663. #define INTERFACE   IDockingWindow
  3664.  
  3665. DECLARE_INTERFACE_(IDockingWindow, IOleWindow)
  3666. {
  3667.     // *** IUnknown methods ***
  3668.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
  3669.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  3670.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  3671.  
  3672.     // *** IOleWindow methods ***
  3673.     STDMETHOD(GetWindow) (THIS_ HWND * lphwnd) PURE;
  3674.     STDMETHOD(ContextSensitiveHelp) (THIS_ BOOL fEnterMode) PURE;
  3675.  
  3676.     // *** IDockingWindow methods ***
  3677.     STDMETHOD(ShowDW)         (THIS_ BOOL fShow) PURE;
  3678.     STDMETHOD(CloseDW)        (THIS_ DWORD dwReserved) PURE;
  3679.     STDMETHOD(ResizeBorderDW) (THIS_ LPCRECT   prcBorder,
  3680.                                      IUnknown* punkToolbarSite,
  3681.                                      BOOL      fReserved) PURE;
  3682. };
  3683.  
  3684.  
  3685. //-------------------------------------------------------------------------
  3686. //
  3687. // IDeskBand interface
  3688. //
  3689. //
  3690. // [Member functions]
  3691. //
  3692. // IDeskBand::GetBandInfo(dwBandID, dwViewMode, pdbi)
  3693. //   Returns info on the given band in *pdbi, according to the mask
  3694. //   field in the DESKBANDINFO structure and the given viewmode.
  3695. //
  3696. //-------------------------------------------------------------------------
  3697.  
  3698.  
  3699. // Mask values for DESKBANDINFO
  3700. #define DBIM_MINSIZE    0x0001
  3701. #define DBIM_MAXSIZE    0x0002
  3702. #define DBIM_INTEGRAL   0x0004
  3703. #define DBIM_ACTUAL     0x0008
  3704. #define DBIM_TITLE      0x0010
  3705. #define DBIM_MODEFLAGS  0x0020
  3706. #define DBIM_BKCOLOR    0x0040
  3707.  
  3708. typedef struct {
  3709.     DWORD       dwMask;
  3710.     POINTL      ptMinSize;
  3711.     POINTL      ptMaxSize;
  3712.     POINTL      ptIntegral;
  3713.     POINTL      ptActual;
  3714.     WCHAR       wszTitle[256];
  3715.     DWORD       dwModeFlags;
  3716.     COLORREF    crBkgnd;
  3717. } DESKBANDINFO;
  3718.  
  3719. // DESKBANDINFO dwModeFlags values
  3720. #define DBIMF_NORMAL            0x0000
  3721. #define DBIMF_VARIABLEHEIGHT    0x0008
  3722. #define DBIMF_DEBOSSED          0x0020
  3723. #define DBIMF_BKCOLOR           0x0040
  3724.  
  3725. // GetBandInfo view mode values
  3726. #define DBIF_VIEWMODE_NORMAL         0x0000
  3727. #define DBIF_VIEWMODE_VERTICAL       0x0001
  3728. #define DBIF_VIEWMODE_FLOATING       0x0002
  3729. #define DBIF_VIEWMODE_TRANSPARENT    0x0004
  3730.  
  3731. #undef  INTERFACE
  3732. #define INTERFACE   IDeskBand
  3733.  
  3734. DECLARE_INTERFACE_(IDeskBand, IDockingWindow)
  3735. {
  3736.     // *** IUnknown methods ***
  3737.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
  3738.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  3739.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  3740.  
  3741.     // *** IOleWindow methods ***
  3742.     STDMETHOD(GetWindow) (THIS_ HWND * lphwnd) PURE;
  3743.     STDMETHOD(ContextSensitiveHelp) (THIS_ BOOL fEnterMode) PURE;
  3744.  
  3745.     // *** IDockingWindow methods ***
  3746.     STDMETHOD(ShowDW)         (THIS_ BOOL fShow) PURE;
  3747.     STDMETHOD(CloseDW)        (THIS_ DWORD dwReserved) PURE;
  3748.     STDMETHOD(ResizeBorderDW) (THIS_ LPCRECT   prcBorder,
  3749.                                      IUnknown* punkToolbarSite,
  3750.                                      BOOL      fReserved) PURE;
  3751.     // *** IDeskBand methods ***
  3752.     STDMETHOD(GetBandInfo)    (THIS_ DWORD dwBandID, DWORD dwViewMode,
  3753.                                 DESKBANDINFO* pdbi) PURE;
  3754.  
  3755. };
  3756.  
  3757. // Command Target IDs
  3758. enum {
  3759.     DBID_BANDINFOCHANGED    = 0,
  3760.     DBID_SHOWONLY           = 1,
  3761.     DBID_MAXIMIZEBAND       = 2,      // Maximize the specified band (VT_UI4 == dwID)
  3762.     DBID_PUSHCHEVRON        = 3,
  3763.     DBID_DELAYINIT          = 4,      // Note: _bandsite_ calls _band_ with this code
  3764.     DBID_FINISHINIT         = 5,      // Note: _bandsite_ calls _band_ with this code
  3765. };
  3766.  
  3767.  
  3768. #if (_WIN32_IE >= 0x0400)
  3769.  
  3770. //-------------------------------------------------------------------------
  3771. //
  3772. // IRunnableTask interface
  3773. //
  3774. //   This is a free threaded interface used for putting items on a background
  3775. // scheduler for execution within the view.  It allows a scheduler to start and
  3776. // stop tasks on as many worker threads as it deems necessary.
  3777. //
  3778. // Run(), Kill() and Suspend() may be called from different threads.
  3779. //
  3780. // [Member functions]
  3781. //
  3782. // IRunnableTask::Run(void)
  3783. //   Initiate the task to run.  This should return E_PENDING if the task
  3784. //   has been suspended.
  3785. //
  3786. // IRunnableTask::Kill(void)
  3787. //
  3788. // IRunnableTask::Suspend(void)
  3789. //
  3790. // IRunnableTask::Resume(void)
  3791. //
  3792. // IRunnableTask::IsRunning(void)
  3793. //
  3794. //-------------------------------------------------------------------------
  3795.  
  3796. // Convenient state values
  3797. #define IRTIR_TASK_NOT_RUNNING  0
  3798. #define IRTIR_TASK_RUNNING      1
  3799. #define IRTIR_TASK_SUSPENDED    2
  3800. #define IRTIR_TASK_PENDING      3
  3801. #define IRTIR_TASK_FINISHED     4
  3802.  
  3803. #undef  INTERFACE
  3804. #define INTERFACE   IRunnableTask
  3805.  
  3806. DECLARE_INTERFACE_( IRunnableTask, IUnknown )
  3807. {
  3808.     // *** IUnknown methods ***
  3809.     STDMETHOD (QueryInterface)(THIS_ REFIID riid, void **ppv) PURE;
  3810.     STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  3811.     STDMETHOD_(ULONG, Release)(THIS) PURE;
  3812.  
  3813.     // *** IRunnableTask methods ***
  3814.     STDMETHOD (Run)(THIS) PURE;
  3815.     STDMETHOD (Kill)(THIS_ BOOL fWait ) PURE;
  3816.     STDMETHOD (Suspend)(THIS) PURE;
  3817.     STDMETHOD (Resume)(THIS) PURE;
  3818.     STDMETHOD_(ULONG, IsRunning)(THIS) PURE;
  3819. };
  3820.  
  3821. typedef IRunnableTask * LPRUNNABLETASK;
  3822. #endif
  3823.  
  3824.  
  3825. #if (_WIN32_IE >= 0x0400)
  3826.  
  3827. // --- IExtractImage
  3828. // this interface is provided for objects to provide a thumbnail image.
  3829. // IExtractImage::GetLocation()
  3830. //      Gets a path description of the image that is to be extracted. This is used to
  3831. //      identify the image in the view so that multiple instances of the same image can reuse the
  3832. //      original image. If *pdwFlags == IEIFLAG_ASYNC and the result is E_PENDING, then *pdwPriority
  3833. //      is used to return the priority of the item, this is usually a measure of how long it will take
  3834. //      to perform the extraction. *pdwFlags can return IEIFLAG_CACHE if the view should cache a copy
  3835. //      of the image for future reference and faster access. This flag is use dto tell the difference
  3836. //      between file formats that cache a thumbnail image  such as Flashpix or Office documents, and those
  3837. //      that don't cache one.
  3838. // IExtractImage::Extract()
  3839. //      Extract the thumbnail of the specified size. If GetLocation() returned the values indicating
  3840. //      it is free-threaded and can be placed on a background thread. If the object
  3841. //      supports IRunnableTask as well, then long extractions can be started and paused as appropriate.
  3842. //      At this point it is asssumed the object is free-threaded.
  3843. //      If dwRecClrDepth contains a recommended Colour depth
  3844. //      If *phBmpthumbnail is non NULL, then it contains the destination bitmap that should be used.
  3845.  
  3846. #define IEI_PRIORITY_MAX        ITSAT_MAX_PRIORITY
  3847. #define IEI_PRIORITY_MIN        ITSAT_MIN_PRIORITY
  3848. #define IEIT_PRIORITY_NORMAL     ITSAT_DEFAULT_PRIORITY
  3849.  
  3850. #define IEIFLAG_ASYNC       0x0001      // ask the extractor if it supports ASYNC extract (free threaded)
  3851. #define IEIFLAG_CACHE       0x0002      // returned from the extractor if it does NOT cache the thumbnail
  3852. #define IEIFLAG_ASPECT      0x0004      // passed to the extractor to beg it to render to the aspect ratio of the supplied rect
  3853. #define IEIFLAG_OFFLINE     0x0008      // if the extractor shouldn't hit the net to get any content neede for the rendering
  3854. #define IEIFLAG_GLEAM       0x0010      // does the image have a gleam ? this will be returned if it does
  3855. #define IEIFLAG_SCREEN      0x0020      // render as if for the screen  (this is exlusive with IEIFLAG_ASPECT )
  3856. #define IEIFLAG_ORIGSIZE    0x0040      // render to the approx size passed, but crop if neccessary
  3857.  
  3858. #undef  INTERFACE
  3859. #define INTERFACE   IExtractImage
  3860.  
  3861. DECLARE_INTERFACE_ ( IExtractImage, IUnknown )
  3862. {
  3863.     // IUnknown methods
  3864.     STDMETHOD (QueryInterface)(THIS_ REFIID riid, void **ppv) PURE;
  3865.     STDMETHOD_(ULONG, AddRef) ( THIS ) PURE;
  3866.     STDMETHOD_(ULONG, Release) ( THIS ) PURE;
  3867.  
  3868.     // *** IExtractImage methods ***
  3869.     STDMETHOD (GetLocation) ( THIS_ LPWSTR pszPathBuffer,
  3870.                               DWORD cch,
  3871.                               DWORD * pdwPriority,
  3872.                               const SIZE * prgSize,
  3873.                               DWORD dwRecClrDepth,
  3874.                               DWORD *pdwFlags ) PURE;
  3875.  
  3876.     STDMETHOD (Extract)( THIS_ HBITMAP * phBmpThumbnail) PURE;
  3877. };
  3878. typedef IExtractImage * LPEXTRACTIMAGE;
  3879.  
  3880.  
  3881. /* ***************** IExtractImage2
  3882.  * GetDateStamp : returns the date stamp associated with the image. If this image is already cached,
  3883.  *                then it is easy to find out if the image is out of date.
  3884.  */
  3885.  
  3886. #undef  INTERFACE
  3887. #define INTERFACE   IExtractImage
  3888.  
  3889. DECLARE_INTERFACE_ ( IExtractImage2, IExtractImage )
  3890. {
  3891.     // IUnknown methods
  3892.     STDMETHOD (QueryInterface)(THIS_ REFIID riid, void **ppv) PURE;
  3893.     STDMETHOD_(ULONG, AddRef) ( THIS ) PURE;
  3894.     STDMETHOD_(ULONG, Release) ( THIS ) PURE;
  3895.  
  3896.     // *** IExtractImage methods ***
  3897.     STDMETHOD (GetLocation) ( THIS_ LPWSTR pszPathBuffer,
  3898.                               DWORD cch,
  3899.                               DWORD * pdwPriority,
  3900.                               const SIZE * prgSize,
  3901.                               DWORD dwRecClrDepth,
  3902.                               DWORD *pdwFlags ) PURE;
  3903.  
  3904.     STDMETHOD (Extract)( THIS_ HBITMAP * phBmpThumbnail) PURE;
  3905.  
  3906.     // *** IExtractImage2 methods ***
  3907.     STDMETHOD (GetDateStamp)( FILETIME * pDateStamp ) PURE;
  3908. };
  3909. typedef IExtractImage2 * LPEXTRACTIMAGE2;
  3910.  
  3911. #endif
  3912.  
  3913.  
  3914. #if (_WIN32_IE >= 0x400)
  3915. //
  3916. // We need to make sure that WININET.H is included before this interface is
  3917. // used because the COMPONENT structure uses INTERNET_MAX_URL_LENGTH
  3918. //
  3919. #ifdef _WININET_
  3920. //
  3921. //  Flags and structures used by IActiveDesktop
  3922. //
  3923.  
  3924. typedef struct _tagWALLPAPEROPT
  3925. {
  3926.     DWORD   dwSize;     // size of this Structure.
  3927.     DWORD   dwStyle;    // WPSTYLE_* mentioned above
  3928. }
  3929. WALLPAPEROPT;
  3930.  
  3931. typedef WALLPAPEROPT  *LPWALLPAPEROPT;
  3932. typedef const WALLPAPEROPT *LPCWALLPAPEROPT;
  3933.  
  3934. typedef struct _tagCOMPONENTSOPT
  3935. {
  3936.     DWORD   dwSize;             //Size of this structure
  3937.     BOOL    fEnableComponents;  //Enable components?
  3938.     BOOL    fActiveDesktop;     // Active desktop enabled ?
  3939. }
  3940. COMPONENTSOPT;
  3941.  
  3942. typedef COMPONENTSOPT   *LPCOMPONENTSOPT;
  3943. typedef const COMPONENTSOPT   *LPCCOMPONENTSOPT;
  3944.  
  3945. typedef struct _tagCOMPPOS
  3946. {
  3947.     DWORD   dwSize;             //Size of this structure
  3948.     int     iLeft;              //Left of top-left corner in screen co-ordinates.
  3949.     int     iTop;               //Top of top-left corner in screen co-ordinates.
  3950.     DWORD   dwWidth;            // Width in pixels.
  3951.     DWORD   dwHeight;           // Height in pixels.
  3952.     int     izIndex;            // Indicates the Z-order of the component.
  3953.     BOOL    fCanResize;         // Is the component resizeable?
  3954.     BOOL    fCanResizeX;        // Resizeable in X-direction?
  3955.     BOOL    fCanResizeY;        // Resizeable in Y-direction?
  3956.     int     iPreferredLeftPercent;    //Left of top-left corner as percent of screen width
  3957.     int     iPreferredTopPercent;     //Top of top-left corner as percent of screen height
  3958. }
  3959. COMPPOS;
  3960.  
  3961. typedef COMPPOS *LPCOMPPOS;
  3962. typedef const COMPPOS *LPCCOMPPOS;
  3963.  
  3964. typedef struct  _tagCOMPSTATEINFO
  3965. {
  3966.     DWORD   dwSize;             // Size of this structure.
  3967.     int     iLeft;              // Left of the top-left corner in screen co-ordinates.
  3968.     int     iTop;               // Top of top-left corner in screen co-ordinates.
  3969.     DWORD   dwWidth;            // Width in pixels.
  3970.     DWORD   dwHeight;           // Height in pixels.
  3971.     DWORD   dwItemState;        // State of the component (full-screen mode or split-screen or normal state.
  3972. }
  3973. COMPSTATEINFO;
  3974.  
  3975. typedef COMPSTATEINFO   *LPCOMPSTATEINFO;
  3976. typedef const COMPSTATEINFO *LPCCOMPSTATEINFO;
  3977.  
  3978.  
  3979.  
  3980. #define COMPONENT_TOP (0x3fffffff)  // izOrder value meaning component is at the top
  3981.  
  3982.  
  3983. // iCompType values
  3984. #define COMP_TYPE_HTMLDOC       0
  3985. #define COMP_TYPE_PICTURE       1
  3986. #define COMP_TYPE_WEBSITE       2
  3987. #define COMP_TYPE_CONTROL       3
  3988. #define COMP_TYPE_CFHTML        4
  3989. #define COMP_TYPE_MAX           4
  3990.  
  3991. // The following is the COMPONENT structure used in IE4.01, IE4.0 and Memphis. It is kept here for compatibility
  3992. // reasons.
  3993. typedef struct _tagIE4COMPONENT
  3994. {
  3995.     DWORD   dwSize;             //Size of this structure
  3996.     DWORD   dwID;               //Reserved: Set it always to zero.
  3997.     int     iComponentType;     //One of COMP_TYPE_*
  3998.     BOOL    fChecked;           // Is this component enabled?
  3999.     BOOL    fDirty;             // Had the component been modified and not yet saved to disk?
  4000.     BOOL    fNoScroll;          // Is the component scrollable?
  4001.     COMPPOS cpPos;              // Width, height etc.,
  4002.     WCHAR   wszFriendlyName[MAX_PATH];          // Friendly name of component.
  4003.     WCHAR   wszSource[INTERNET_MAX_URL_LENGTH]; //URL of the component.
  4004.     WCHAR   wszSubscribedURL[INTERNET_MAX_URL_LENGTH]; //Subscrined URL
  4005. }
  4006. IE4COMPONENT;
  4007.  
  4008. typedef IE4COMPONENT *LPIE4COMPONENT;
  4009. typedef const IE4COMPONENT *LPCIE4COMPONENT;
  4010.  
  4011. //
  4012. // The following is the new NT5 component structure. Note that the initial portion of this component exactly
  4013. // matches the IE4COMPONENT structure. All new fields are added at the bottom and the dwSize field is used to
  4014. // distinguish between IE4COMPONENT and the new COMPONENT structures.
  4015. //
  4016. typedef struct _tagCOMPONENT
  4017. {
  4018.     DWORD   dwSize;             //Size of this structure
  4019.     DWORD   dwID;               //Reserved: Set it always to zero.
  4020.     int     iComponentType;     //One of COMP_TYPE_*
  4021.     BOOL    fChecked;           // Is this component enabled?
  4022.     BOOL    fDirty;             // Had the component been modified and not yet saved to disk?
  4023.     BOOL    fNoScroll;          // Is the component scrollable?
  4024.     COMPPOS cpPos;              // Width, height etc.,
  4025.     WCHAR   wszFriendlyName[MAX_PATH];          // Friendly name of component.
  4026.     WCHAR   wszSource[INTERNET_MAX_URL_LENGTH]; //URL of the component.
  4027.     WCHAR   wszSubscribedURL[INTERNET_MAX_URL_LENGTH]; //Subscrined URL
  4028.  
  4029.     //New fields are added below. Everything above here must exactly match the IE4COMPONENT Structure.
  4030.     DWORD           dwCurItemState; // Current state of the Component.
  4031.     COMPSTATEINFO   csiOriginal;    // Original state of the component when it was first added.
  4032.     COMPSTATEINFO   csiRestored;    // Restored state of the component.
  4033. }
  4034. COMPONENT;
  4035.  
  4036. typedef COMPONENT *LPCOMPONENT;
  4037. typedef const COMPONENT *LPCCOMPONENT;
  4038.  
  4039.  
  4040. // Defines for dwCurItemState
  4041. #define IS_NORMAL               0x00000001
  4042. #define IS_FULLSCREEN           0x00000002
  4043. #define IS_SPLIT                0x00000004
  4044. #define IS_VALIDSIZESTATEBITS   (IS_NORMAL | IS_SPLIT | IS_FULLSCREEN)  // The set of IS_* state bits which define the "size" of the component - these bits are mutually exclusive.
  4045. #define IS_VALIDSTATEBITS       (IS_NORMAL | IS_SPLIT | IS_FULLSCREEN | 0x80000000 | 0x40000000)  // All of the currently defined IS_* bits.
  4046.  
  4047. ////////////////////////////////////////////
  4048. // Flags for IActiveDesktop::ApplyChanges()
  4049. #define AD_APPLY_SAVE             0x00000001
  4050. #define AD_APPLY_HTMLGEN          0x00000002
  4051. #define AD_APPLY_REFRESH          0x00000004
  4052. #define AD_APPLY_ALL              (AD_APPLY_SAVE | AD_APPLY_HTMLGEN | AD_APPLY_REFRESH)
  4053. #define AD_APPLY_FORCE            0x00000008
  4054. #define AD_APPLY_BUFFERED_REFRESH 0x00000010
  4055. #define AD_APPLY_DYNAMICREFRESH   0x00000020
  4056.  
  4057. ////////////////////////////////////////////
  4058. // Flags for IActiveDesktop::GetWallpaperOptions()
  4059. //           IActiveDesktop::SetWallpaperOptions()
  4060. #define WPSTYLE_CENTER      0
  4061. #define WPSTYLE_TILE        1
  4062. #define WPSTYLE_STRETCH     2
  4063. #define WPSTYLE_MAX         3
  4064.  
  4065.  
  4066. ////////////////////////////////////////////
  4067. // Flags for IActiveDesktop::ModifyComponent()
  4068.  
  4069. #define COMP_ELEM_TYPE          0x00000001
  4070. #define COMP_ELEM_CHECKED       0x00000002
  4071. #define COMP_ELEM_DIRTY         0x00000004
  4072. #define COMP_ELEM_NOSCROLL      0x00000008
  4073. #define COMP_ELEM_POS_LEFT      0x00000010
  4074. #define COMP_ELEM_POS_TOP       0x00000020
  4075. #define COMP_ELEM_SIZE_WIDTH    0x00000040
  4076. #define COMP_ELEM_SIZE_HEIGHT   0x00000080
  4077. #define COMP_ELEM_POS_ZINDEX    0x00000100
  4078. #define COMP_ELEM_SOURCE        0x00000200
  4079. #define COMP_ELEM_FRIENDLYNAME  0x00000400
  4080. #define COMP_ELEM_SUBSCRIBEDURL 0x00000800
  4081. #define COMP_ELEM_ORIGINAL_CSI  0x00001000
  4082. #define COMP_ELEM_RESTORED_CSI  0x00002000
  4083. #define COMP_ELEM_CURITEMSTATE  0x00004000
  4084.  
  4085. #define COMP_ELEM_ALL   (COMP_ELEM_TYPE | COMP_ELEM_CHECKED | COMP_ELEM_DIRTY |                     \
  4086.                          COMP_ELEM_NOSCROLL | COMP_ELEM_POS_LEFT | COMP_ELEM_SIZE_WIDTH  |          \
  4087.                          COMP_ELEM_SIZE_HEIGHT | COMP_ELEM_POS_ZINDEX | COMP_ELEM_SOURCE |          \
  4088.                          COMP_ELEM_FRIENDLYNAME | COMP_ELEM_POS_TOP | COMP_ELEM_SUBSCRIBEDURL |     \
  4089.                          COMP_ELEM_ORIGINAL_CSI | COMP_ELEM_RESTORED_CSI | COMP_ELEM_CURITEMSTATE)
  4090.  
  4091.  
  4092. ////////////////////////////////////////////
  4093. // Flags for IActiveDesktop::AddDesktopItemWithUI()
  4094. typedef enum tagDTI_ADTIWUI
  4095. {
  4096.     DTI_ADDUI_DEFAULT               = 0x00000000,
  4097.     DTI_ADDUI_DISPSUBWIZARD         = 0x00000001,
  4098.     DTI_ADDUI_POSITIONITEM          = 0x00000002,
  4099. #ifdef __BORLANDC__
  4100. } DTI_ADTIWUI;
  4101. #else
  4102. };
  4103. #endif /* __BORLANDC__ */
  4104.  
  4105.  
  4106. ////////////////////////////////////////////
  4107. // Flags for IActiveDesktop::AddUrl()
  4108. #define ADDURL_SILENT           0X0001
  4109.  
  4110.  
  4111. ////////////////////////////////////////////
  4112. // Default positions for ADI
  4113. #define COMPONENT_DEFAULT_LEFT    (0xFFFF)
  4114. #define COMPONENT_DEFAULT_TOP     (0xFFFF)
  4115.  
  4116.  
  4117.  
  4118.  
  4119. //
  4120. //  Interface for manipulating the Active Desktop.
  4121. //
  4122.  
  4123. #undef INTERFACE
  4124. #define INTERFACE IActiveDesktop
  4125.  
  4126. DECLARE_INTERFACE_( IActiveDesktop, IUnknown )
  4127. {
  4128.     // IUnknown methods
  4129.     STDMETHOD (QueryInterface)(THIS_ REFIID riid, void **ppv) PURE;
  4130.     STDMETHOD_(ULONG, AddRef) ( THIS ) PURE;
  4131.     STDMETHOD_(ULONG, Release) ( THIS ) PURE;
  4132.  
  4133.     // IActiveDesktop methods
  4134.     STDMETHOD (ApplyChanges)(THIS_ DWORD dwFlags) PURE;
  4135.     STDMETHOD (GetWallpaper)(THIS_ LPWSTR pwszWallpaper, UINT cchWallpaper, DWORD dwReserved) PURE;
  4136.     STDMETHOD (SetWallpaper)(THIS_ LPCWSTR pwszWallpaper, DWORD dwReserved) PURE;
  4137.     STDMETHOD (GetWallpaperOptions)(THIS_ LPWALLPAPEROPT pwpo, DWORD dwReserved) PURE;
  4138.     STDMETHOD (SetWallpaperOptions)(THIS_ LPCWALLPAPEROPT pwpo, DWORD dwReserved) PURE;
  4139.     STDMETHOD (GetPattern)(THIS_ LPWSTR pwszPattern, UINT cchPattern, DWORD dwReserved) PURE;
  4140.     STDMETHOD (SetPattern)(THIS_ LPCWSTR pwszPattern, DWORD dwReserved) PURE;
  4141.     STDMETHOD (GetDesktopItemOptions)(THIS_ LPCOMPONENTSOPT pco, DWORD dwReserved) PURE;
  4142.     STDMETHOD (SetDesktopItemOptions)(THIS_ LPCCOMPONENTSOPT pco, DWORD dwReserved) PURE;
  4143.     STDMETHOD (AddDesktopItem)(THIS_ LPCCOMPONENT pcomp, DWORD dwReserved) PURE;
  4144.     STDMETHOD (AddDesktopItemWithUI)(THIS_ HWND hwnd, LPCOMPONENT pcomp, DWORD dwReserved) PURE;
  4145.     STDMETHOD (ModifyDesktopItem)(THIS_ LPCCOMPONENT pcomp, DWORD dwFlags) PURE;
  4146.     STDMETHOD (RemoveDesktopItem)(THIS_ LPCCOMPONENT pcomp, DWORD dwReserved) PURE;
  4147.     STDMETHOD (GetDesktopItemCount)(THIS_ LPINT lpiCount, DWORD dwReserved) PURE;
  4148.     STDMETHOD (GetDesktopItem)(THIS_ int nComponent, LPCOMPONENT pcomp, DWORD dwReserved) PURE;
  4149.     STDMETHOD (GetDesktopItemByID)(THIS_ ULONG_PTR dwID, LPCOMPONENT pcomp, DWORD dwReserved) PURE;
  4150.     STDMETHOD (GenerateDesktopItemHtml)(THIS_ LPCWSTR pwszFileName, LPCOMPONENT pcomp, DWORD dwReserved) PURE;
  4151.     STDMETHOD (AddUrl)(THIS_ HWND hwnd, LPCWSTR pszSource, LPCOMPONENT pcomp, DWORD dwFlags) PURE;
  4152.     STDMETHOD (GetDesktopItemBySource)(THIS_ LPCWSTR pwszSource, LPCOMPONENT pcomp, DWORD dwReserved) PURE;
  4153. };
  4154.  
  4155. typedef IActiveDesktop * LPACTIVEDESKTOP;
  4156.  
  4157.  
  4158. #endif // _WININET_
  4159.  
  4160. #if (_WIN32_IE >= 0x0500)
  4161.  
  4162. #define MAX_COLUMN_NAME_LEN 80
  4163. #define MAX_COLUMN_DESC_LEN 128
  4164.  
  4165. typedef struct {
  4166.     ULONG   dwFlags ;             // initialization flags
  4167.     ULONG   dwReserved ;          // reserved for future use.
  4168.     WCHAR   wszFolder[MAX_PATH];  // fully qualified folder path (or empty if multiple folders)
  4169. } SHCOLUMNINIT, *LPSHCOLUMNINIT;
  4170. typedef const SHCOLUMNINIT* LPCSHCOLUMNINIT;
  4171.  
  4172. typedef struct {
  4173.     SHCOLUMNID  scid;                           // OUT the unique identifier of this column
  4174.     VARTYPE     vt;                             // OUT the native type of the data returned
  4175.     DWORD       fmt;                            // OUT this listview format (LVCFMT_LEFT, usually)
  4176.     UINT        cChars;                         // OUT the default width of the column, in characters
  4177.     DWORD       csFlags;                        // OUT SHCOLSTATE flags
  4178.     WCHAR wszTitle[MAX_COLUMN_NAME_LEN];        // OUT the title of the column
  4179.     WCHAR wszDescription[MAX_COLUMN_DESC_LEN];  // OUT full description of this column
  4180. } SHCOLUMNINFO, *LPSHCOLUMNINFO ;
  4181. typedef const SHCOLUMNINFO* LPCSHCOLUMNINFO ;
  4182.  
  4183. #define SHCDF_UPDATEITEM        0x00000001      // this flag is a hint that the file has changed since the last call to GetItemData
  4184.  
  4185. typedef struct {
  4186.     ULONG   dwFlags ;            // combination of SHCDF_ flags.
  4187.     DWORD   dwFileAttributes ;   // file attributes.
  4188.     ULONG   dwReserved ;         // reserved for future use.
  4189.     WCHAR*  pwszExt ;            // address of file name extension
  4190.     WCHAR   wszFile[MAX_PATH] ;  // Absolute path of file.
  4191. } SHCOLUMNDATA, *LPSHCOLUMNDATA ;
  4192. typedef const SHCOLUMNDATA* LPCSHCOLUMNDATA ;
  4193.  
  4194. #undef INTERFACE
  4195. #define INTERFACE IColumnProvider
  4196.  
  4197. // Note: these objects must be threadsafe!  GetItemData _will_ be called
  4198. // simultaneously from multiple threads.
  4199. DECLARE_INTERFACE_(IColumnProvider, IUnknown)
  4200. {
  4201.     // IUnknown methods
  4202.     STDMETHOD (QueryInterface)(THIS_ REFIID riid, void **ppv) PURE;
  4203.     STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  4204.     STDMETHOD_(ULONG, Release)(THIS) PURE;
  4205.  
  4206.     // IColumnProvider methods
  4207.     STDMETHOD (Initialize)(THIS_ LPCSHCOLUMNINIT psci) PURE;
  4208.     STDMETHOD (GetColumnInfo)(THIS_ DWORD dwIndex, SHCOLUMNINFO *psci) PURE;
  4209.     STDMETHOD (GetItemData)(THIS_ LPCSHCOLUMNID pscid, LPCSHCOLUMNDATA pscd, VARIANT *pvarData) PURE;
  4210. };
  4211.  
  4212.  
  4213. ///////////////////////////////////////////////////////
  4214. //
  4215. // Drag and Drop helper
  4216. //
  4217. // Purpose: To expose the Shell drag images
  4218. //
  4219. // This interface is implemented in the shell by CLSID_DragDropHelper.
  4220. //
  4221. // To use:
  4222. //   If you are the source of a drag (i.e. in response to LV_DRAGBEGIN or
  4223. //    equivelent begin drag message) call
  4224. //    IDragSourceHelper::InitializeFromWindow
  4225. //              (<hwnd of window supporting DI_GETDRAGIMAGE>,
  4226. //               <pointer to POINT indicating offset to the mouse from
  4227. //                  the upper left corner of the image>,
  4228. //               <pointer to data object>)
  4229. //
  4230. //      NOTE: The Data object must support IDataObject::SetData with multiple
  4231. //            data types and GetData must implement data type cloning
  4232. //            (Including HGLOBAL), not just aliasing.
  4233. //
  4234. //   If you wish to have an image while over your application add the
  4235. //    IDragImages::Dr* calls to your IDropTarget implementation. For Example:
  4236. //
  4237. //    STDMETHODIMP CUserDropTarget::DragEnter(IDataObject* pDataObject,
  4238. //                                            DWORD grfKeyState,
  4239. //                                            POINTL pt, DWORD* pdwEffect)
  4240. //    {
  4241. //          // Process your DragEnter
  4242. //          // Call IDragImages::DragEnter last.
  4243. //          _pDropTargetHelper->DragEnter(_hwndDragOver, pDataObject,
  4244. //                                        (POINT*)&pt, *pdwEffect);
  4245. //          return hres;
  4246. //    }
  4247. //
  4248. //
  4249. //   If you wish to be able to source a drag image from a custom control,
  4250. //     implement a handler for the RegisterWindowMessage(DI_GETDRAGIMAGE).
  4251. //     The LPARAM is a pointer to an SHDRAGIMAGE structure.
  4252. //
  4253. //      sizeDragImage  -   Calculate the length and width required to render
  4254. //                          the images.
  4255. //      ptOffset       -   Calculate the offset from the upper left corner to
  4256. //                          the mouse cursor within the image
  4257. //      hbmpDragImage  -   CreateBitmap( sizeDragImage.cx, sizeDragImage.cy,
  4258. //                           GetDeviceCaps(hdcScreen, PLANES),
  4259. //                           GetDeviceCaps(hdcScreen, BITSPIXEL),
  4260. //                           NULL);
  4261. //
  4262. //   Drag Images will only be displayed on Windows NT 5.0 or later.
  4263. //
  4264. //
  4265. //   Note about IDropTargetHelper::Show - This method is provided for
  4266. //     showing/hiding the Drag image in low color depth video modes. When
  4267. //     painting to a window that is currently being dragged over (i.e. For
  4268. //     indicating a selection) you need to hide the drag image by calling this
  4269. //     method passing FALSE. After the window is done painting, Show the image
  4270. //     again by passing TRUE.
  4271.  
  4272. // This is sent to a window to get the rendered images to a bitmap
  4273. typedef struct
  4274. {
  4275.     SIZE        sizeDragImage;      // OUT - The length and Width of the
  4276.                                     //        rendered image
  4277.     POINT       ptOffset;           // OUT - The Offset from the mouse cursor to
  4278.                                     //        the upper left corner of the image
  4279.     HBITMAP     hbmpDragImage;      // OUT - The Bitmap containing the rendered
  4280.                                     //        drag images
  4281.     COLORREF    crColorKey;         // OUT - The COLORREF that has been blitted
  4282.                                     //        to the background of the images
  4283. } SHDRAGIMAGE, *LPSHDRAGIMAGE;
  4284.  
  4285. // Call RegisterWindowMessage to get the ID
  4286. #define DI_GETDRAGIMAGE     TEXT("ShellGetDragImage")
  4287.  
  4288. #undef INTERFACE
  4289. #define INTERFACE IDropTargetHelper
  4290.  
  4291. DECLARE_INTERFACE_( IDropTargetHelper, IUnknown )
  4292. {
  4293.     // IUnknown methods
  4294.     STDMETHOD (QueryInterface)(THIS_ REFIID riid, void **ppv) PURE;
  4295.     STDMETHOD_(ULONG, AddRef) ( THIS ) PURE;
  4296.     STDMETHOD_(ULONG, Release) ( THIS ) PURE;
  4297.  
  4298.     // IDropTargetHelper
  4299.     STDMETHOD (DragEnter)(THIS_ HWND hwndTarget, IDataObject* pDataObject,
  4300.                           POINT* ppt, DWORD dwEffect) PURE;
  4301.     STDMETHOD (DragLeave)(THIS) PURE;
  4302.     STDMETHOD (DragOver)(THIS_ POINT* ppt, DWORD dwEffect) PURE;
  4303.     STDMETHOD (Drop)(THIS_ IDataObject* pDataObject, POINT* ppt,
  4304.                      DWORD dwEffect) PURE;
  4305.     STDMETHOD (Show)(THIS_ BOOL fShow) PURE;
  4306.  
  4307. };
  4308.  
  4309. #undef INTERFACE
  4310. #define INTERFACE IDragSourceHelper
  4311.  
  4312. DECLARE_INTERFACE_( IDragSourceHelper, IUnknown )
  4313. {
  4314.     // IUnknown methods
  4315.     STDMETHOD (QueryInterface)(THIS_ REFIID riid, void **ppv) PURE;
  4316.     STDMETHOD_(ULONG, AddRef) ( THIS ) PURE;
  4317.     STDMETHOD_(ULONG, Release) ( THIS ) PURE;
  4318.  
  4319.     // IDragSourceHelper
  4320.     STDMETHOD (InitializeFromBitmap)(THIS_ LPSHDRAGIMAGE pshdi,
  4321.                                      IDataObject* pDataObject) PURE;
  4322.     STDMETHOD (InitializeFromWindow)(THIS_ HWND hwnd, POINT* ppt,
  4323.                                      IDataObject* pDataObject) PURE;
  4324. };
  4325. #endif // _WIN32_IE >= 0x0500
  4326. #endif // _WIN32_IE
  4327.  
  4328. //==========================================================================
  4329. // Clipboard format which may be supported by IDataObject from system
  4330. // defined shell folders (such as directories, network, ...).
  4331. //==========================================================================
  4332.  
  4333. #define CFSTR_SHELLIDLIST       TEXT("Shell IDList Array")      // CF_IDLIST
  4334. #define CFSTR_SHELLIDLISTOFFSET TEXT("Shell Object Offsets")    // CF_OBJECTPOSITIONS
  4335. #define CFSTR_NETRESOURCES      TEXT("Net Resource")            // CF_NETRESOURCE
  4336. #define CFSTR_FILEDESCRIPTORA   TEXT("FileGroupDescriptor")     // CF_FILEGROUPDESCRIPTORA
  4337. #define CFSTR_FILEDESCRIPTORW   TEXT("FileGroupDescriptorW")    // CF_FILEGROUPDESCRIPTORW
  4338. #define CFSTR_FILECONTENTS      TEXT("FileContents")            // CF_FILECONTENTS
  4339. #define CFSTR_FILENAMEA         TEXT("FileName")                // CF_FILENAMEA
  4340. #define CFSTR_FILENAMEW         TEXT("FileNameW")               // CF_FILENAMEW
  4341. #define CFSTR_PRINTERGROUP      TEXT("PrinterFriendlyName")     // CF_PRINTERS
  4342. #define CFSTR_FILENAMEMAPA      TEXT("FileNameMap")             // CF_FILENAMEMAPA
  4343. #define CFSTR_FILENAMEMAPW      TEXT("FileNameMapW")            // CF_FILENAMEMAPW
  4344. #define CFSTR_SHELLURL          TEXT("UniformResourceLocator")
  4345. #define CFSTR_PREFERREDDROPEFFECT TEXT("Preferred DropEffect")
  4346. #define CFSTR_PERFORMEDDROPEFFECT TEXT("Performed DropEffect")
  4347. #define CFSTR_PASTESUCCEEDED    TEXT("Paste Succeeded")
  4348. #define CFSTR_INDRAGLOOP        TEXT("InShellDragLoop")
  4349. #define CFSTR_DRAGCONTEXT       TEXT("DragContext")
  4350. #define CFSTR_MOUNTEDVOLUME     TEXT("MountedVolume")
  4351. #define CFSTR_PERSISTEDDATAOBJECT     TEXT("PersistedDataObject")
  4352. #define CFSTR_TARGETCLSID        TEXT("TargetCLSID")                // HGLOBAL with a CLSID of the drop target
  4353. #define CFSTR_LOGICALPERFORMEDDROPEFFECT  TEXT("Logical Performed DropEffect")
  4354.  
  4355. #ifdef UNICODE
  4356. #define CFSTR_FILEDESCRIPTOR    CFSTR_FILEDESCRIPTORW
  4357. #define CFSTR_FILENAME          CFSTR_FILENAMEW
  4358. #define CFSTR_FILENAMEMAP       CFSTR_FILENAMEMAPW
  4359. #else
  4360. #define CFSTR_FILEDESCRIPTOR    CFSTR_FILEDESCRIPTORA
  4361. #define CFSTR_FILENAME          CFSTR_FILENAMEA
  4362. #define CFSTR_FILENAMEMAP       CFSTR_FILENAMEMAPA
  4363. #endif
  4364.  
  4365. #define DVASPECT_SHORTNAME      2 // use for CF_HDROP to get short name version of file paths
  4366. #define DVASPECT_COPY           3 // use to indicate format is a "Copy" of the data (FILECONTENTS, FILEDESCRIPTOR, etc)
  4367. #define DVASPECT_LINK           4 // use to indicate format is a "Shortcut" to the data (FILECONTENTS, FILEDESCRIPTOR, etc)
  4368.  
  4369. //
  4370. // format of CF_NETRESOURCE
  4371. //
  4372. typedef struct _NRESARRAY {     // anr
  4373.     UINT cItems;
  4374.     NETRESOURCE nr[1];
  4375. } NRESARRAY, * LPNRESARRAY;
  4376.  
  4377. //
  4378. // format of CF_IDLIST
  4379. //
  4380. typedef struct _IDA {
  4381.     UINT cidl;          // number of relative IDList
  4382.     UINT aoffset[1];    // [0]: folder IDList, [1]-[cidl]: item IDList
  4383. } CIDA, * LPIDA;
  4384.  
  4385. //
  4386. // FILEDESCRIPTOR.dwFlags field indicate which fields are to be used
  4387. //
  4388. typedef enum {
  4389.     FD_CLSID            = 0x0001,
  4390.     FD_SIZEPOINT        = 0x0002,
  4391.     FD_ATTRIBUTES       = 0x0004,
  4392.     FD_CREATETIME       = 0x0008,
  4393.     FD_ACCESSTIME       = 0x0010,
  4394.     FD_WRITESTIME       = 0x0020,
  4395.     FD_FILESIZE         = 0x0040,
  4396.     FD_PROGRESSUI       = 0x4000,       // Show Progress UI w/Drag and Drop
  4397.     FD_LINKUI           = 0x8000,       // 'link' UI is prefered
  4398. } FD_FLAGS;
  4399.  
  4400. typedef struct _FILEDESCRIPTORA { // fod
  4401.     DWORD dwFlags;
  4402.  
  4403.     CLSID clsid;
  4404.     SIZEL sizel;
  4405.     POINTL pointl;
  4406.  
  4407.     DWORD dwFileAttributes;
  4408.     FILETIME ftCreationTime;
  4409.     FILETIME ftLastAccessTime;
  4410.     FILETIME ftLastWriteTime;
  4411.     DWORD nFileSizeHigh;
  4412.     DWORD nFileSizeLow;
  4413.     CHAR   cFileName[ MAX_PATH ];
  4414. } FILEDESCRIPTORA, *LPFILEDESCRIPTORA;
  4415.  
  4416. typedef struct _FILEDESCRIPTORW { // fod
  4417.     DWORD dwFlags;
  4418.  
  4419.     CLSID clsid;
  4420.     SIZEL sizel;
  4421.     POINTL pointl;
  4422.  
  4423.     DWORD dwFileAttributes;
  4424.     FILETIME ftCreationTime;
  4425.     FILETIME ftLastAccessTime;
  4426.     FILETIME ftLastWriteTime;
  4427.     DWORD nFileSizeHigh;
  4428.     DWORD nFileSizeLow;
  4429.     WCHAR  cFileName[ MAX_PATH ];
  4430. } FILEDESCRIPTORW, *LPFILEDESCRIPTORW;
  4431.  
  4432. #ifdef UNICODE
  4433. #define FILEDESCRIPTOR      FILEDESCRIPTORW
  4434. #define LPFILEDESCRIPTOR    LPFILEDESCRIPTORW
  4435. #else
  4436. #define FILEDESCRIPTOR      FILEDESCRIPTORA
  4437. #define LPFILEDESCRIPTOR    LPFILEDESCRIPTORA
  4438. #endif
  4439.  
  4440. //
  4441. // format of CF_FILEGROUPDESCRIPTOR
  4442. //
  4443. typedef struct _FILEGROUPDESCRIPTORA { // fgd
  4444.      UINT cItems;
  4445.      FILEDESCRIPTORA fgd[1];
  4446. } FILEGROUPDESCRIPTORA, * LPFILEGROUPDESCRIPTORA;
  4447.  
  4448. typedef struct _FILEGROUPDESCRIPTORW { // fgd
  4449.      UINT cItems;
  4450.      FILEDESCRIPTORW fgd[1];
  4451. } FILEGROUPDESCRIPTORW, * LPFILEGROUPDESCRIPTORW;
  4452.  
  4453. #ifdef UNICODE
  4454. #define FILEGROUPDESCRIPTOR     FILEGROUPDESCRIPTORW
  4455. #define LPFILEGROUPDESCRIPTOR   LPFILEGROUPDESCRIPTORW
  4456. #else
  4457. #define FILEGROUPDESCRIPTOR     FILEGROUPDESCRIPTORA
  4458. #define LPFILEGROUPDESCRIPTOR   LPFILEGROUPDESCRIPTORA
  4459. #endif
  4460.  
  4461. //
  4462. // format of CF_HDROP and CF_PRINTERS, in the HDROP case the data that follows
  4463. // is a double null terinated list of file names, for printers they are printer
  4464. // friendly names
  4465. //
  4466. typedef struct _DROPFILES {
  4467.    DWORD pFiles;                       // offset of file list
  4468.    POINT pt;                           // drop point (client coords)
  4469.    BOOL fNC;                           // is it on NonClient area
  4470.                                        // and pt is in screen coords
  4471.    BOOL fWide;                         // WIDE character switch
  4472. } DROPFILES, *LPDROPFILES;
  4473.  
  4474.  
  4475. //====== File System Notification APIs ===============================
  4476. //
  4477.  
  4478. //
  4479. //  File System Notification flags
  4480. //
  4481.  
  4482. #define SHCNE_RENAMEITEM          0x00000001L
  4483. #define SHCNE_CREATE              0x00000002L
  4484. #define SHCNE_DELETE              0x00000004L
  4485. #define SHCNE_MKDIR               0x00000008L
  4486. #define SHCNE_RMDIR               0x00000010L
  4487. #define SHCNE_MEDIAINSERTED       0x00000020L
  4488. #define SHCNE_MEDIAREMOVED        0x00000040L
  4489. #define SHCNE_DRIVEREMOVED        0x00000080L
  4490. #define SHCNE_DRIVEADD            0x00000100L
  4491. #define SHCNE_NETSHARE            0x00000200L
  4492. #define SHCNE_NETUNSHARE          0x00000400L
  4493. #define SHCNE_ATTRIBUTES          0x00000800L
  4494. #define SHCNE_UPDATEDIR           0x00001000L
  4495. #define SHCNE_UPDATEITEM          0x00002000L
  4496. #define SHCNE_SERVERDISCONNECT    0x00004000L
  4497. #define SHCNE_UPDATEIMAGE         0x00008000L
  4498. #define SHCNE_DRIVEADDGUI         0x00010000L
  4499. #define SHCNE_RENAMEFOLDER        0x00020000L
  4500. #define SHCNE_FREESPACE           0x00040000L
  4501.  
  4502. #if (_WIN32_IE >= 0x0400)
  4503. // SHCNE_EXTENDED_EVENT: the extended event is identified in dwItem1,
  4504. // packed in LPITEMIDLIST format (same as SHCNF_DWORD packing).
  4505. // Additional information can be passed in the dwItem2 parameter
  4506. // of SHChangeNotify (called "pidl2" below), which if present, must also
  4507. // be in LPITEMIDLIST format.
  4508. //
  4509. // Unlike the standard events, the extended events are ORDINALs, so we
  4510. // don't run out of bits.  Extended events follow the SHCNEE_* naming
  4511. // convention.
  4512. //
  4513. // The dwItem2 parameter varies according to the extended event.
  4514.  
  4515. #define SHCNE_EXTENDED_EVENT      0x04000000L
  4516. #endif      // _WIN32_IE >= 0x0400
  4517.  
  4518. #define SHCNE_ASSOCCHANGED        0x08000000L
  4519.  
  4520. #define SHCNE_DISKEVENTS          0x0002381FL
  4521. #define SHCNE_GLOBALEVENTS        0x0C0581E0L // Events that dont match pidls first
  4522. #define SHCNE_ALLEVENTS           0x7FFFFFFFL
  4523. #define SHCNE_INTERRUPT           0x80000000L // The presence of this flag indicates
  4524.                                             // that the event was generated by an
  4525.                                             // interrupt.  It is stripped out before
  4526.                                             // the clients of SHCNNotify_ see it.
  4527.  
  4528. #if (_WIN32_IE >= 0x0400)
  4529. // SHCNE_EXTENDED_EVENT extended events.  These events are ordinals.
  4530. // This is not a bitfield.
  4531.  
  4532. #define SHCNEE_ORDERCHANGED         2L  // pidl2 is the changed folder
  4533. #define SHCNEE_MSI_CHANGE           4L  // pidl2 is a SHChangeProductKeyAsIDList
  4534. #define SHCNEE_MSI_UNINSTALL        5L  // pidl2 is a SHChangeProductKeyAsIDList
  4535. #endif
  4536.  
  4537.  
  4538. // Flags
  4539. // uFlags & SHCNF_TYPE is an ID which indicates what dwItem1 and dwItem2 mean
  4540. #define SHCNF_IDLIST      0x0000        // LPITEMIDLIST
  4541. #define SHCNF_PATHA       0x0001        // path name
  4542. #define SHCNF_PRINTERA    0x0002        // printer friendly name
  4543. #define SHCNF_DWORD       0x0003        // DWORD
  4544. #define SHCNF_PATHW       0x0005        // path name
  4545. #define SHCNF_PRINTERW    0x0006        // printer friendly name
  4546. #define SHCNF_TYPE        0x00FF
  4547. #define SHCNF_FLUSH       0x1000
  4548. #define SHCNF_FLUSHNOWAIT 0x2000
  4549.  
  4550. #ifdef UNICODE
  4551. #define SHCNF_PATH      SHCNF_PATHW
  4552. #define SHCNF_PRINTER   SHCNF_PRINTERW
  4553. #else
  4554. #define SHCNF_PATH      SHCNF_PATHA
  4555. #define SHCNF_PRINTER   SHCNF_PRINTERA
  4556. #endif
  4557.  
  4558.  
  4559. //
  4560. //  APIs
  4561. //
  4562. SHSTDAPI_(void) SHChangeNotify(LONG wEventId, UINT uFlags, LPCVOID dwItem1, LPCVOID dwItem2);
  4563.  
  4564. //
  4565. // IShellChangeNotify
  4566. //
  4567. #undef  INTERFACE
  4568. #define INTERFACE  IShellChangeNotify
  4569.  
  4570. DECLARE_INTERFACE_(IShellChangeNotify, IUnknown)
  4571. {
  4572.     // *** IUnknown methods ***
  4573.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
  4574.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  4575.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  4576.  
  4577.     // *** IShellChangeNotify methods ***
  4578.     STDMETHOD(OnChange) (THIS_ LONG lEvent, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2) PURE;
  4579. } ;
  4580.  
  4581. //
  4582. // IQueryInfo
  4583. //
  4584. #undef  INTERFACE
  4585. #define INTERFACE  IQueryInfo
  4586.  
  4587. DECLARE_INTERFACE_(IQueryInfo, IUnknown)
  4588. {
  4589.     // *** IUnknown methods ***
  4590.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
  4591.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  4592.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  4593.  
  4594.     // *** IQueryInfo methods ***
  4595.     STDMETHOD(GetInfoTip)(THIS_ DWORD dwFlags, WCHAR **ppwszTip) PURE;
  4596.     STDMETHOD(GetInfoFlags)(THIS_ DWORD *pdwFlags) PURE;
  4597. } ;
  4598.  
  4599. #define QITIPF_DEFAULT          0x00000000
  4600. #define QITIPF_USENAME          0x00000001
  4601. #define QITIPF_LINKNOTARGET     0x00000002
  4602. #define QITIPF_LINKUSETARGET    0x00000004
  4603.  
  4604.  
  4605. #define QIF_CACHED           0x00000001
  4606. #define QIF_DONTEXPANDFOLDER 0x00000002
  4607.  
  4608.  
  4609. //
  4610. // SHAddToRecentDocs
  4611. //
  4612. #define SHARD_PIDL      0x00000001L
  4613. #define SHARD_PATHA     0x00000002L
  4614. #define SHARD_PATHW     0x00000003L
  4615.  
  4616. #ifdef UNICODE
  4617. #define SHARD_PATH  SHARD_PATHW
  4618. #else
  4619. #define SHARD_PATH  SHARD_PATHA
  4620. #endif
  4621.  
  4622. SHSTDAPI_(void) SHAddToRecentDocs(UINT uFlags, LPCVOID pv);
  4623. #if (_WIN32_IE >= 0x0400)
  4624. typedef struct _SHChangeProductKeyAsIDList {
  4625.     USHORT cb;
  4626.     WCHAR wszProductKey[39];
  4627.     USHORT cbZero;
  4628. } SHChangeProductKeyAsIDList, *LPSHChangeProductKeyAsIDList;
  4629.  
  4630. SHSTDAPI_(void) SHUpdateImageA(LPCSTR pszHashItem, int iIndex, UINT uFlags, int iImageIndex);
  4631. SHSTDAPI_(void) SHUpdateImageW(LPCWSTR pszHashItem, int iIndex, UINT uFlags, int iImageIndex);
  4632. #ifdef UNICODE
  4633. #define SHUpdateImage  SHUpdateImageW
  4634. #else
  4635. #define SHUpdateImage  SHUpdateImageA
  4636. #endif // !UNICODE
  4637. #endif /* _WIN32_IE */
  4638.  
  4639.  
  4640. SHSTDAPI SHGetInstanceExplorer(IUnknown **ppunk);
  4641.  
  4642. //
  4643. // SHGetDataFromIDListA/W
  4644. //
  4645. // SHGetDataFromIDList nFormat values TCHAR
  4646. #define SHGDFIL_FINDDATA        1
  4647. #define SHGDFIL_NETRESOURCE     2
  4648. #define SHGDFIL_DESCRIPTIONID   3
  4649.  
  4650. #define SHDID_ROOT_REGITEM          1
  4651. #define SHDID_FS_FILE               2
  4652. #define SHDID_FS_DIRECTORY          3
  4653. #define SHDID_FS_OTHER              4
  4654. #define SHDID_COMPUTER_DRIVE35      5
  4655. #define SHDID_COMPUTER_DRIVE525     6
  4656. #define SHDID_COMPUTER_REMOVABLE    7
  4657. #define SHDID_COMPUTER_FIXED        8
  4658. #define SHDID_COMPUTER_NETDRIVE     9
  4659. #define SHDID_COMPUTER_CDROM        10
  4660. #define SHDID_COMPUTER_RAMDISK      11
  4661. #define SHDID_COMPUTER_OTHER        12
  4662. #define SHDID_NET_DOMAIN            13
  4663. #define SHDID_NET_SERVER            14
  4664. #define SHDID_NET_SHARE             15
  4665. #define SHDID_NET_RESTOFNET         16
  4666. #define SHDID_NET_OTHER             17
  4667.  
  4668. typedef struct _SHDESCRIPTIONID {
  4669.     DWORD   dwDescriptionId;
  4670.     CLSID   clsid;
  4671. } SHDESCRIPTIONID, *LPSHDESCRIPTIONID;
  4672.  
  4673. // these delegate to IShellFolder2::GetItemData()
  4674.  
  4675. SHSTDAPI SHGetDataFromIDListA(IShellFolder *psf, LPCITEMIDLIST pidl, int nFormat, void *pv, int cb);
  4676. SHSTDAPI SHGetDataFromIDListW(IShellFolder *psf, LPCITEMIDLIST pidl, int nFormat, void *pv, int cb);
  4677. #ifdef UNICODE
  4678. #define SHGetDataFromIDList  SHGetDataFromIDListW
  4679. #else
  4680. #define SHGetDataFromIDList  SHGetDataFromIDListA
  4681. #endif // !UNICODE
  4682.  
  4683.  
  4684. //===========================================================================
  4685.  
  4686.  
  4687. //
  4688. // PROPIDs for Internet Shortcuts (FMTID_Intshcut) to be used with
  4689. // IPropertySetStorage/IPropertyStorage
  4690. //
  4691. // The known property ids and their variant types are:
  4692. //      PID_IS_URL          [VT_LPWSTR]   URL
  4693. //      PID_IS_NAME         [VT_LPWSTR]   Name of the internet shortcut
  4694. //      PID_IS_WORKINGDIR   [VT_LPWSTR]   Working directory for the shortcut
  4695. //      PID_IS_HOTKEY       [VT_UI2]      Hotkey for the shortcut
  4696. //      PID_IS_SHOWCMD      [VT_I4]       Show command for shortcut
  4697. //      PID_IS_ICONINDEX    [VT_I4]       Index into file that has icon
  4698. //      PID_IS_ICONFILE     [VT_LPWSTR]   File that has the icon
  4699. //      PID_IS_WHATSNEW     [VT_LPWSTR]   What's New text
  4700. //      PID_IS_AUTHOR       [VT_LPWSTR]   Author
  4701. //      PID_IS_DESCRIPTION  [VT_LPWSTR]   Description text of site
  4702. //      PID_IS_COMMENT      [VT_LPWSTR]   User annotated comment
  4703. //
  4704.  
  4705. #define PID_IS_URL           2
  4706. #define PID_IS_NAME          4
  4707. #define PID_IS_WORKINGDIR    5
  4708. #define PID_IS_HOTKEY        6
  4709. #define PID_IS_SHOWCMD       7
  4710. #define PID_IS_ICONINDEX     8
  4711. #define PID_IS_ICONFILE      9
  4712. #define PID_IS_WHATSNEW      10
  4713. #define PID_IS_AUTHOR        11
  4714. #define PID_IS_DESCRIPTION   12
  4715. #define PID_IS_COMMENT       13
  4716.  
  4717. //
  4718. // PROPIDs for Internet Sites (FMTID_InternetSite) to be used with
  4719. // IPropertySetStorage/IPropertyStorage
  4720. //
  4721. // The known property ids and their variant types are:
  4722. //      PID_INTSITE_WHATSNEW     [VT_LPWSTR]   What's New text
  4723. //      PID_INTSITE_AUTHOR       [VT_LPWSTR]   Author
  4724. //      PID_INTSITE_LASTVISIT    [VT_FILETIME] Time site was last visited
  4725. //      PID_INTSITE_LASTMOD      [VT_FILETIME] Time site was last modified
  4726. //      PID_INTSITE_VISITCOUNT   [VT_UI4]      Number of times user has visited
  4727. //      PID_INTSITE_DESCRIPTION  [VT_LPWSTR]   Description text of site
  4728. //      PID_INTSITE_COMMENT      [VT_LPWSTR]   User annotated comment
  4729. //      PID_INTSITE_RECURSE      [VT_UI4]      Levels to recurse (0-3)
  4730. //      PID_INTSITE_WATCH        [VT_UI4]      PIDISM_ flags
  4731. //      PID_INTSITE_SUBSCRIPTION [VT_UI8]      Subscription cookie
  4732. //      PID_INTSITE_URL          [VT_LPWSTR]   URL
  4733. //      PID_INTSITE_TITLE        [VT_LPWSTR]   Title
  4734. //      PID_INTSITE_CODEPAGE     [VT_UI4]      Codepage of the document
  4735. //      PID_INTSITE_TRACKING     [VT_UI4]      Tracking
  4736. //      PID_INTSITE_ICONINDEX    [VT_I4]       Retrieve the index to the icon
  4737. //      PID_INTSITE_ICONFILE     [VT_LPWSTR]   Retrieve the file containing the icon index.
  4738.  
  4739.  
  4740. #define PID_INTSITE_WHATSNEW      2
  4741. #define PID_INTSITE_AUTHOR        3
  4742. #define PID_INTSITE_LASTVISIT     4
  4743. #define PID_INTSITE_LASTMOD       5
  4744. #define PID_INTSITE_VISITCOUNT    6
  4745. #define PID_INTSITE_DESCRIPTION   7
  4746. #define PID_INTSITE_COMMENT       8
  4747. #define PID_INTSITE_FLAGS         9
  4748. #define PID_INTSITE_CONTENTLEN    10
  4749. #define PID_INTSITE_CONTENTCODE   11
  4750. #define PID_INTSITE_RECURSE       12
  4751. #define PID_INTSITE_WATCH         13
  4752. #define PID_INTSITE_SUBSCRIPTION  14
  4753. #define PID_INTSITE_URL           15
  4754. #define PID_INTSITE_TITLE         16
  4755. #define PID_INTSITE_CODEPAGE      18
  4756. #define PID_INTSITE_TRACKING      19
  4757. #define PID_INTSITE_ICONINDEX     20
  4758. #define PID_INTSITE_ICONFILE      21
  4759.  
  4760.  
  4761. // Flags for PID_IS_FLAGS
  4762. #define PIDISF_RECENTLYCHANGED  0x00000001
  4763. #define PIDISF_CACHEDSTICKY     0x00000002
  4764. #define PIDISF_CACHEIMAGES      0x00000010
  4765. #define PIDISF_FOLLOWALLLINKS   0x00000020
  4766.  
  4767. // Values for PID_INTSITE_WATCH
  4768. #define PIDISM_GLOBAL           0       // Monitor based on global setting
  4769. #define PIDISM_WATCH            1       // User says watch
  4770. #define PIDISM_DONTWATCH        2       // User says don't watch
  4771.  
  4772.  
  4773. ////////////////////////////////////////////////////////////////////
  4774. //
  4775. // The shell keeps track of some per-user state to handle display
  4776. // options that is of major interest to ISVs.
  4777. // The key one requested right now is "DoubleClickInWebView".
  4778. //
  4779. //  SysFiles are these windows special files:
  4780. //      "dll sys vxd 386 drv"
  4781. //
  4782. //  hidden files are files with the FILE_ATTRIBUTE_HIDDEN attribute
  4783. //
  4784. //  system files are files with the FILE_ATTRIBUTE_SYSTEM attribute
  4785. //
  4786. //      fShowAllObjects fShowSysFiles   Result
  4787. //      --------------- -------------   ------
  4788. //      0               0               hide hidden + SysFiles + system files
  4789. //      0               1               hide hidden files.
  4790. //      1               0               show all files.
  4791. //      1               1               show all files.
  4792. //
  4793. typedef struct {
  4794.     BOOL fShowAllObjects : 1;
  4795.     BOOL fShowExtensions : 1;
  4796.     BOOL fNoConfirmRecycle : 1;
  4797.     BOOL fShowSysFiles : 1;
  4798.     BOOL fShowCompColor : 1;
  4799.     BOOL fDoubleClickInWebView : 1;
  4800.     BOOL fDesktopHTML : 1;
  4801.     BOOL fWin95Classic : 1;
  4802.     BOOL fDontPrettyPath : 1;
  4803.     BOOL fShowAttribCol : 1;
  4804.     BOOL fMapNetDrvBtn : 1;
  4805.     BOOL fShowInfoTip : 1;
  4806.     BOOL fHideIcons : 1;
  4807.     UINT fRestFlags : 3;
  4808. } SHELLFLAGSTATE, * LPSHELLFLAGSTATE;
  4809.  
  4810. #define SSF_SHOWALLOBJECTS          0x00000001
  4811. #define SSF_SHOWEXTENSIONS          0x00000002
  4812. #define SSF_SHOWCOMPCOLOR           0x00000008
  4813. #define SSF_SHOWSYSFILES            0x00000020
  4814. #define SSF_DOUBLECLICKINWEBVIEW    0x00000080
  4815. #define SSF_SHOWATTRIBCOL           0x00000100
  4816. #define SSF_DESKTOPHTML             0x00000200
  4817. #define SSF_WIN95CLASSIC            0x00000400
  4818. #define SSF_DONTPRETTYPATH          0x00000800
  4819. #define SSF_SHOWINFOTIP             0x00002000
  4820. #define SSF_MAPNETDRVBUTTON         0x00001000
  4821. #define SSF_NOCONFIRMRECYCLE        0x00008000
  4822. #define SSF_HIDEICONS               0x00004000
  4823.  
  4824. // SHGetSettings(LPSHELLFLAGSTATE lpss, DWORD dwMask)
  4825. //
  4826. // Specify the bits you are interested in in dwMask and they will be
  4827. // filled out in the lpss structure.
  4828. //
  4829. // When these settings change, a WM_SETTINGCHANGE message is sent
  4830. // with the string lParam value of "ShellState".
  4831. //
  4832. SHSTDAPI_(void) SHGetSettings(LPSHELLFLAGSTATE lpsfs, DWORD dwMask);
  4833.  
  4834. // SHBindToParent(LPCITEMIDLIST pidl, REFIID riid, void **ppv, LPCITEMIDLIST *ppidlLast)
  4835. //
  4836. // Given a pidl, you can get an interface pointer (as specified by riid) of the pidl's parent folder (in ppv)
  4837. // If ppidlLast is non-NULL, you can also get the pidl of the last item.
  4838. //
  4839. STDAPI SHBindToParent(LPCITEMIDLIST pidl, REFIID riid, void **ppv, LPCITEMIDLIST *ppidlLast);
  4840.  
  4841.  
  4842.  
  4843. // SHPathPrepareForWrite(HWND hwnd, IUnknown *punkEnableModless, LPCTSTR pszPath, DWORD dwFlags)
  4844. //
  4845. // DESCRIPTION:
  4846. //     This API will prepare the path for the caller.  This includes:
  4847. // 1. Prompting for the ejectable media to be re-inserted. (Floppy, CD-ROM, ZIP drive, etc.)
  4848. // 2. Prompting for the media to be formatted. (Floppy, hard drive, etc.)
  4849. // 3. Remount mapped drives if the connection was lost. (\\unc\share mapped to N: becomes disconnected)
  4850. // 4. If the path doesn't exist, create it.  (SHPPFW_DIRCREATE and SHPPFW_ASKDIRCREATE)
  4851. // 5. Display an error if the media is read only. (SHPPFW_NOWRITECHECK not set)
  4852. //
  4853. // PARAMETERS:
  4854. //      hwnd: Parernt window for UI.  NULL means don't display UI. OPTIONAL
  4855. //      punkEnableModless: Parent that will be set to modal during UI using IOleInPlaceActiveObject::EnableModeless(). OPTIONAL
  4856. //      pszPath: Path to verify is valid for writting.  This can be a UNC or file drive path.  The path
  4857. //               should only contain directories.  Pass SHPPFW_IGNOREFILENAME if the last path segment
  4858. //               is always filename to ignore.
  4859. //      dwFlags: SHPPFW_* Flags to modify behavior
  4860. //
  4861. //-------------------------------------------------------------------------
  4862. #define SHPPFW_NONE             0x00000000
  4863. #define SHPPFW_DEFAULT          SHPPFW_DIRCREATE        // May change
  4864. #define SHPPFW_DIRCREATE        0x00000001              // Create the directory if it doesn't exist without asking the user.
  4865. #define SHPPFW_ASKDIRCREATE     0x00000002              // Create the directory if it doesn't exist after asking the user.
  4866. #define SHPPFW_IGNOREFILENAME   0x00000004              // Ignore the last item in pszPath because it's a file.  Example: pszPath="C:\DirA\DirB", only use "C:\DirA".
  4867. #define SHPPFW_NOWRITECHECK     0x00000008              // Caller only needs to read from the drive, so don't check if it's READ ONLY.
  4868.  
  4869. STDAPI SHPathPrepareForWriteA(HWND hwnd, IUnknown *punkEnableModless, LPCSTR pszPath, DWORD dwFlags);
  4870. STDAPI SHPathPrepareForWriteW(HWND hwnd, IUnknown *punkEnableModless, LPCWSTR pszPath, DWORD dwFlags);
  4871. #ifdef UNICODE
  4872. #define SHPathPrepareForWrite  SHPathPrepareForWriteW
  4873. #else
  4874. #define SHPathPrepareForWrite  SHPathPrepareForWriteA
  4875. #endif // !UNICODE
  4876.  
  4877.  
  4878.  
  4879. #ifdef __urlmon_h__
  4880. //    NOTE: urlmon.h must be included before shlobj.h to access this function.
  4881. //
  4882. //    SoftwareUpdateMessageBox
  4883. //
  4884. //    Provides a standard message box for the alerting the user that a software
  4885. //    update is available or installed. No UI will be displayed if there is no
  4886. //    update available or if the available update version is less than or equal
  4887. //    to the Advertised update version.
  4888. //
  4889. //    hWnd                - [in] Handle of owner window
  4890. //    szDistUnit          - [in] Unique identifier string for a code distribution unit. For
  4891. //                               ActiveX controls and Active Setup installed components, this
  4892. //                               is typically a GUID string.
  4893. //    dwFlags             - [in] Must be 0.
  4894. //    psdi                - [in,out] Pointer to SOFTDISTINFO ( see URLMon.h ). May be NULL.
  4895. //                                cbSize should be initialized
  4896. //                                by the caller to sizeof(SOFTDISTINFO), dwReserved should be set to 0.
  4897. //
  4898. //    RETURNS:
  4899. //
  4900. //    IDNO     - The user chose cancel. If *pbRemind is FALSE, the caller should save the
  4901. //               update version from the SOFTDISTINFO and pass it in as the Advertised
  4902. //               version in future calls.
  4903. //
  4904. //    IDYES    - The user has selected Update Now/About Update. The caller should navigate to
  4905. //               the SOFTDISTINFO's pszHREF to initiate the install or learn about it.
  4906. //               The caller should save the update version from the SOFTDISTINFO and pass
  4907. //               it in as the Advertised version in future calls.
  4908. //
  4909. //    IDIGNORE - There is no pending software update. Note: There is
  4910. //               no Ignore button in the standard UI. This occurs if the available
  4911. //               version is less than the installed version or is not present or if the
  4912. //               Advertised version is greater than or equal to the update version.
  4913. //
  4914. //    IDABORT  - An error occured. Call GetSoftwareUpdateInfo() for a more specific HRESULT.
  4915. //               Note: There is no Abort button in the standard UI.
  4916.  
  4917.  
  4918. SHDOCAPI_(DWORD) SoftwareUpdateMessageBox( HWND hWnd,
  4919.                                            LPCWSTR szDistUnit,
  4920.                                            DWORD dwFlags,
  4921.                                            LPSOFTDISTINFO psdi );
  4922. #endif // if __urlmon_h__
  4923.  
  4924.  
  4925.  
  4926. #ifdef __cplusplus
  4927. }
  4928.  
  4929. #endif  /* __cplusplus */
  4930.  
  4931. #ifndef RC_INVOKED
  4932. #include <poppack.h>
  4933. #endif  /* !RC_INVOKED */
  4934.  
  4935. #pragma option pop /*P_O_Pop*/
  4936. #endif // _SHLOBJ_H_
  4937.