home *** CD-ROM | disk | FTP | other *** search
/ Team Palmtops 7 / Palmtops_numero07.iso / WinCE / SDKWindowsCE / HandHeldPCPro30 / sdk.exe / Jupiter SDK / data1.cab / Emulation_Include_Files / shlobj.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-02-19  |  45.4 KB  |  1,167 lines

  1. //===========================================================================
  2. //
  3. // Copyright (c) Microsoft Corporation 1991-1995
  4. //
  5. // File: shlobj.h
  6. //
  7. //===========================================================================
  8.  
  9. #ifndef _SHLOBJ_H_
  10. #define _SHLOBJ_H_
  11.  
  12. //
  13. // Define API decoration for direct importing of DLL references.
  14. //
  15. #ifndef WINSHELLAPI
  16. #if !defined(_SHELL32_)
  17. #define WINSHELLAPI DECLSPEC_IMPORT
  18. #else
  19. #define WINSHELLAPI
  20. #endif
  21. #endif // WINSHELLAPI
  22.  
  23. #ifndef _PRSHT_H_
  24. #include <prsht.h>
  25. #endif
  26. #ifndef _INC_COMMCTRL
  27. #include <commctrl.h>    // for LPTBBUTTON
  28. #endif
  29.  
  30. #ifndef INITGUID
  31. #include <shlguid.h>
  32. #endif /* !INITGUID */
  33.  
  34. #ifndef RC_INVOKED
  35. #pragma pack(1)         /* Assume byte packing throughout */
  36. #endif /* !RC_INVOKED */
  37.  
  38. #ifdef __cplusplus
  39. extern "C" {            /* Assume C declarations for C++ */
  40. #endif  /* __cplusplus */
  41.  
  42. //===========================================================================
  43. //
  44. // Object identifiers in the explorer's name space (ItemID and IDList)
  45. //
  46. //  All the items that the user can browse with the explorer (such as files,
  47. // directories, servers, work-groups, etc.) has an identifier which is unique
  48. // among items within the parent folder. Those identifiers are called item
  49. // IDs (SHITEMID). Since all its parent folders have their own item IDs,
  50. // any items can be uniquely identified by a list of item IDs, which is called
  51. // an ID list (ITEMIDLIST).
  52. //
  53. //  ID lists are almost always allocated by the task allocator (see some
  54. // description below as well as OLE 2.0 SDK) and may be passed across
  55. // some of shell interfaces (such as IShellFolder). Each item ID in an ID list
  56. // is only meaningful to its parent folder (which has generated it), and all
  57. // the clients must treat it as an opaque binary data except the first two
  58. // bytes, which indicates the size of the item ID.
  59. //
  60. //  When a shell extension -- which implements the IShellFolder interace --
  61. // generates an item ID, it may put any information in it, not only the data
  62. // with that it needs to identifies the item, but also some additional
  63. // information, which would help implementing some other functions efficiently.
  64. // For example, the shell's IShellFolder implementation of file system items
  65. // stores the primary (long) name of a file or a directory as the item
  66. // identifier, but it also stores its alternative (short) name, size and date
  67. // etc.
  68. //
  69. //  When an ID list is passed to one of shell APIs (such as SHGetPathFromIDList),
  70. // it is always an absolute path -- relative from the root of the name space,
  71. // which is the desktop folder. When an ID list is passed to one of IShellFolder
  72. // member function, it is always a relative path from the folder (unless it
  73. // is explicitly specified).
  74. //
  75. //===========================================================================
  76.  
  77. //
  78. // SHITEMID -- Item ID
  79. //
  80. typedef struct _SHITEMID    // mkid
  81. {
  82. #ifdef TARGET_NT    
  83.     USHORT    cb;        // Size of the ID (including cb itself)
  84. #else
  85.     UINT    cb;     // Cheat for DWORD alignment
  86. #endif
  87.     BYTE    abID[1];    // The item ID (variable length)
  88. } SHITEMID, * LPSHITEMID;
  89. typedef const SHITEMID  * LPCSHITEMID;
  90.  
  91. //
  92. // ITEMIDLIST -- List if item IDs (combined with 0-terminator)
  93. //
  94. typedef struct _ITEMIDLIST    // idl
  95. {
  96.     SHITEMID    mkid;
  97. } ITEMIDLIST, * LPITEMIDLIST;
  98. typedef const ITEMIDLIST * LPCITEMIDLIST;
  99.  
  100.  
  101. WINSHELLAPI HRESULT WINAPI SHGetMalloc(LPMALLOC * ppMalloc);
  102.  
  103. //===========================================================================
  104. //
  105. // IContextMenu interface
  106. //
  107. // [OverView]
  108. //
  109. //  The shell uses the IContextMenu interface in following three cases.
  110. //
  111. // case-1: The shell is loading context menu extensions.
  112. //
  113. //   When the user clicks the right mouse button on an item within the shell's
  114. //  name space (i.g., file, directory, server, work-group, etc.), it creates
  115. //  the default context menu for its type, then loads context menu extensions
  116. //  that are registered for that type (and its base type) so that they can
  117. //  add extra menu items. Those context menu extensions are registered at
  118. //  HKCR\{ProgID}\shellex\ContextMenuHandlers.
  119. //
  120. // case-2: The shell is retrieving a context menu of sub-folders in extended
  121. //   name-space.
  122. //
  123. //   When the explorer's name space is extended by name space extensions,
  124. //  the shell calls their IShellFolder::GetUIObjectOf to get the IContextMenu
  125. //  objects when it creates context menus for folders under those extended
  126. //  name spaces.
  127. //
  128. // case-3: The shell is loading non-default drag and drop handler for directories.
  129. //
  130. //   When the user performed a non-default drag and drop onto one of file
  131. //  system folders (i.e., directories), it loads shell extensions that are
  132. //  registered at HKCR\{ProgID}\DragDropHandlers.
  133. //
  134. //
  135. // [Member functions]
  136. //
  137. //
  138. // IContextMenu::QueryContextMenu
  139. //
  140. //   This member function may insert one or more menuitems to the specified
  141. //  menu (hmenu) at the specified location (indexMenu which is never be -1).
  142. //  The IDs of those menuitem must be in the specified range (idCmdFirst and
  143. //  idCmdLast). It returns the maximum menuitem ID offset (ushort) in the
  144. //  'code' field (low word) of the scode.
  145. //
  146. //   The uFlags specify the context. It may have one or more of following
  147. //  flags.
  148. //
  149. //  CMF_DEFAULTONLY: This flag is passed if the user is invoking the default
  150. //   action (typically by double-clicking, case 1 and 2 only). Context menu
  151. //   extensions (case 1) should not add any menu items, and returns NOERROR.
  152. //
  153. //  CMF_VERBSONLY: The explorer passes this flag if it is constructing
  154. //   a context menu for a short-cut object (case 1 and case 2 only). If this
  155. //   flag is passed, it should not add any menu-items that is not appropriate
  156. //   from a short-cut.
  157. //    A good example is the "Delete" menuitem, which confuses the user
  158. //   because it is not clear whether it deletes the link source item or the
  159. //   link itself.
  160. //
  161. //  CMF_EXPLORER: The explorer passes this flag if it has the left-side pane
  162. //   (case 1 and 2 only). Context menu extensions should ignore this flag.
  163. //
  164. //   High word (16-bit) are reserved for context specific communications
  165. //  and the rest of flags (13-bit) are reserved by the system.
  166. //
  167. //
  168. // IContextMenu::InvokeCommand
  169. //
  170. //   This member is called when the user has selected one of menuitems that
  171. //  are inserted by previous QueryContextMenu member. In this case, the
  172. //  LOWORD(lpici->lpVerb) contains the menuitem ID offset (menuitem ID -
  173. //  idCmdFirst).
  174. //
  175. //   This member function may also be called programmatically. In such a case,
  176. //  lpici->lpVerb specifies the canonical name of the command to be invoked,
  177. //  which is typically retrieved by GetCommandString member previously.
  178. //
  179. //  Parameters in lpci:
  180. //    cbSize -- Specifies the size of this structure (sizeof(*lpci))
  181. //    hwnd   -- Specifies the owner window for any message/dialog box.
  182. //    fMask  -- Specifies whether or not dwHotkey/hIcon paramter is valid.
  183. //    lpVerb -- Specifies the command to be invoked.
  184. //    lpParameters -- Parameters (optional)
  185. //    lpDirectory  -- Working directory (optional)
  186. //    nShow -- Specifies the flag to be passed to ShowWindow (SW_*).
  187. //    dwHotKey -- Hot key to be assigned to the app after invoked (optional).
  188. //    hIcon -- Specifies the icon (optional).
  189. //
  190. //
  191. // IContextMenu::GetCommandString
  192. //
  193. //   This member function is called by the explorer either to get the
  194. //  canonical (language independent) command name (uFlags == GCS_VERB) or
  195. //  the help text ((uFlags & GCS_HELPTEXT) != 0) for the specified command.
  196. //  The retrieved canonical string may be passed to its InvokeCommand
  197. //  member function to invoke a command programmatically. The explorer
  198. //  displays the help texts in its status bar; therefore, the length of
  199. //  the help text should be reasonably short (<40 characters).
  200. //
  201. //  Parameters:
  202. //   idCmd -- Specifies menuitem ID offset (from idCmdFirst)
  203. //   uFlags -- Either GCS_VERB or GCS_HELPTEXT
  204. //   pwReserved -- Reserved (must pass NULL when calling, must ignore when called)
  205. //   pszName -- Specifies the string buffer.
  206. //   cchMax -- Specifies the size of the string buffer.
  207. //
  208. //===========================================================================
  209.  
  210. #undef  INTERFACE
  211. #define INTERFACE   IContextMenu
  212.  
  213. // QueryContextMenu uFlags
  214. #define CMF_NORMAL         0x00000000
  215. #define CMF_DEFAULTONLY      0x00000001
  216. #define CMF_VERBSONLY        0x00000002
  217. #define CMF_EXPLORE         0x00000004
  218. #define CMF_RESERVED         0xffff0000    // View specific
  219.  
  220. // GetCommandString uFlags
  221. #define GCS_VERB         0x00000000     // canonical verb
  222. #define GCS_HELPTEXT     0x00000001    // help text (for status bar)
  223. #define GCS_VALIDATE     0x00000002    // validate command exists
  224.  
  225. #define CMDSTR_NEWFOLDER     "NewFolder"
  226. #define CMDSTR_VIEWLIST      "ViewList"
  227. #define CMDSTR_VIEWDETAILS   "ViewDetails"
  228.  
  229. #define CMIC_MASK_HOTKEY    SEE_MASK_HOTKEY
  230. #define CMIC_MASK_ICON        SEE_MASK_ICON
  231. #define CMIC_MASK_FLAG_NO_UI    SEE_MASK_FLAG_NO_UI
  232. #define CMIC_MASK_MODAL         0x80000000                /* ; Internal */
  233.  
  234. #define CMIC_VALID_SEE_FLAGS    SEE_VALID_CMIC_FLAGS            /* ; Internal */
  235.  
  236. typedef struct _CMInvokeCommandInfo {
  237.     DWORD cbSize;     // must be sizeof(CMINVOKECOMMANDINFO)
  238.     DWORD fMask;     // any combination of CMIC_MASK_*
  239.     HWND hwnd;         // might be NULL (indicating no owner window)
  240.     LPCSTR lpVerb;     // either a string of MAKEINTRESOURCE(idOffset)
  241.     LPCSTR lpParameters; // might be NULL (indicating no parameter)
  242.     LPCSTR lpDirectory;     // might be NULL (indicating no specific directory)
  243.     int nShow;         // one of SW_ values for ShowWindow() API
  244.  
  245.     DWORD dwHotKey;
  246.     HANDLE hIcon;
  247. } CMINVOKECOMMANDINFO,  *LPCMINVOKECOMMANDINFO;
  248.  
  249. #undef  INTERFACE
  250. #define INTERFACE   IContextMenu
  251.  
  252. DECLARE_INTERFACE_(IContextMenu, IUnknown)
  253. {
  254.     // *** IUnknown methods ***
  255.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  256.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  257.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  258.  
  259.     STDMETHOD(QueryContextMenu)(THIS_
  260.                                 HMENU hmenu,
  261.                                 UINT indexMenu,
  262.                                 UINT idCmdFirst,
  263.                                 UINT idCmdLast,
  264.                                 UINT uFlags) PURE;
  265.  
  266.     STDMETHOD(InvokeCommand)(THIS_
  267.                              LPCMINVOKECOMMANDINFO lpici) PURE;
  268.  
  269.     STDMETHOD(GetCommandString)(THIS_
  270.                                 UINT        idCmd,
  271.                                 UINT        uType,
  272.                                 UINT      * pwReserved,
  273.                                 LPSTR       pszName,
  274.                                 UINT        cchMax) PURE;
  275. };
  276.  
  277. typedef IContextMenu *    LPCONTEXTMENU;
  278.  
  279. //===========================================================================
  280. //
  281. // Interface: IShellExtInit
  282. //
  283. //  The IShellExtInit interface is used by the explorer to initialize shell
  284. // extension objects. The explorer (1) calls CoCreateInstance (or equivalent)
  285. // with the registered CLSID and IID_IShellExtInit, (2) calls its Initialize
  286. // member, then (3) calls its QueryInterface to a particular interface (such
  287. // as IContextMenu or IPropSheetExt and (4) performs the rest of operation.
  288. //
  289. //
  290. // [Member functions]
  291. //
  292. // IShellExtInit::Initialize
  293. //
  294. //  This member function is called when the explorer is initializing either
  295. // context menu extension, property sheet extension or non-default drag-drop
  296. // extension.
  297. //
  298. //  Parameters: (context menu or property sheet extension)
  299. //   pidlFolder -- Specifies the parent folder
  300. //   lpdobj -- Spefifies the set of items selected in that folder.
  301. //   hkeyProgID -- Specifies the type of the focused item in the selection.
  302. //
  303. //  Parameters: (non-default drag-and-drop extension)
  304. //   pidlFolder -- Specifies the target (destination) folder
  305. //   lpdobj -- Specifies the items that are dropped (see the description
  306. //    about shell's clipboard below for clipboard formats).
  307. //   hkeyProgID -- Specifies the folder type.
  308. //
  309. //===========================================================================
  310.  
  311. #undef  INTERFACE
  312. #define INTERFACE   IShellExtInit
  313.  
  314. DECLARE_INTERFACE_(IShellExtInit, IUnknown)
  315. {
  316.     // *** IUnknown methods ***
  317.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  318.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  319.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  320.  
  321.     // *** IShellExtInit methods ***
  322.     STDMETHOD(Initialize)(THIS_ LPCITEMIDLIST pidlFolder,
  323.                   LPDATAOBJECT lpdobj, HKEY hkeyProgID) PURE;
  324. };
  325.                                     
  326. typedef IShellExtInit *    LPSHELLEXTINIT;
  327.  
  328. //===========================================================================
  329. //
  330. // Interface: IShellPropSheetExt
  331. //
  332. //  The explorer uses the IShellPropSheetExt to allow property sheet
  333. // extensions or control panel extensions to add additional property
  334. // sheet pages.
  335. //
  336. //
  337. // [Member functions]
  338. //
  339. // IShellPropSheetExt::AddPages
  340. //
  341. //  The explorer calls this member function when it finds a registered
  342. // property sheet extension for a particular type of object. For each
  343. // additional page, the extension creates a page object by calling
  344. // CreatePropertySheetPage API and calls lpfnAddPage.
  345. //
  346. //  Parameters:
  347. //   lpfnAddPage -- Specifies the callback function.
  348. //   lParam -- Specifies the opaque handle to be passed to the callback function.
  349. //
  350. //
  351. // IShellPropSheetExt::ReplacePage
  352. //
  353. //  The explorer never calls this member of property sheet extensions. The
  354. // explorer calls this member of control panel extensions, so that they
  355. // can replace some of default control panel pages (such as a page of
  356. // mouse control panel).
  357. //
  358. //  Parameters:
  359. //   uPageID -- Specifies the page to be replaced.
  360. //   lpfnReplace Specifies the callback function.
  361. //   lParam -- Specifies the opaque handle to be passed to the callback function.
  362. //
  363. //===========================================================================
  364.  
  365. #undef  INTERFACE
  366. #define INTERFACE   IShellPropSheetExt
  367.  
  368. DECLARE_INTERFACE_(IShellPropSheetExt, IUnknown)
  369. {
  370.     // *** IUnknown methods ***
  371.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  372.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  373.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  374.  
  375.     // *** IShellPropSheetExt methods ***
  376.     STDMETHOD(AddPages)(THIS_ LPFNADDPROPSHEETPAGE lpfnAddPage, LPARAM lParam) PURE;
  377.     STDMETHOD(ReplacePage)(THIS_ UINT uPageID, LPFNADDPROPSHEETPAGE lpfnReplaceWith, LPARAM lParam) PURE;
  378. };
  379.  
  380. typedef IShellPropSheetExt * LPSHELLPROPSHEETEXT;
  381.  
  382. //===========================================================================
  383. //
  384. // IExtractIcon interface
  385. //
  386. //  This interface is used in two different places in the shell.
  387. //
  388. // Case-1: Icons of sub-folders for the scope-pane of the explorer.
  389. //
  390. //  It is used by the explorer to get the "icon location" of
  391. // sub-folders from each shell folders. When the user expands a folder
  392. // in the scope pane of the explorer, the explorer does following:
  393. //  (1) binds to the folder (gets IShellFolder),
  394. //  (2) enumerates its sub-folders by calling its EnumObjects member,
  395. //  (3) calls its GetUIObjectOf member to get IExtractIcon interface
  396. //     for each sub-folders.
  397. //  In this case, the explorer uses only IExtractIcon::GetIconLocation
  398. // member to get the location of the appropriate icon. An icon location
  399. // always consists of a file name (typically DLL or EXE) and either an icon
  400. // resource or an icon index.
  401. //
  402. //
  403. // Case-2: Extracting an icon image from a file
  404. //
  405. //  It is used by the shell when it extracts an icon image
  406. // from a file. When the shell is extracting an icon from a file,
  407. // it does following:
  408. //  (1) creates the icon extraction handler object (by getting its CLSID
  409. //     under the {ProgID}\shell\ExtractIconHanler key and calling
  410. //     CoCreateInstance requesting for IExtractIcon interface).
  411. //  (2) Calls IExtractIcon::GetIconLocation.
  412. //  (3) Then, calls IExtractIcon::Extract with the location/index pair.
  413. //  (4) If (3) returns NOERROR, it uses the returned icon.
  414. //  (5) Otherwise, it recursively calls this logic with new location
  415. //     assuming that the location string contains a fully qualified path name.
  416. //
  417. //  From extension programmer's point of view, there are only two cases
  418. // where they provide implementations of IExtractIcon:
  419. //  Case-1) providing explorer extensions (i.e., IShellFolder).
  420. //  Case-2) providing per-instance icons for some types of files.
  421. //
  422. // Because Case-1 is described above, we'll explain only Case-2 here.
  423. //
  424. // When the shell is about display an icon for a file, it does following:
  425. //  (1) Finds its ProgID and ClassID.
  426. //  (2) If the file has a ClassID, it gets the icon location string from the
  427. //    "DefaultIcon" key under it. The string indicates either per-class
  428. //    icon (e.g., "FOOBAR.DLL,2") or per-instance icon (e.g., "%1,1").
  429. //  (3) If a per-instance icon is specified, the shell creates an icon
  430. //    extraction handler object for it, and extracts the icon from it
  431. //    (which is described above).
  432. //
  433. //  It is important to note that the shell calls IExtractIcon::GetIconLocation
  434. // first, then calls IExtractIcon::Extract. Most application programs
  435. // that support per-instance icons will probably store an icon location
  436. // (DLL/EXE name and index/id) rather than an icon image in each file.
  437. // In those cases, a programmer needs to implement only the GetIconLocation
  438. // member and it Extract member simply returns S_FALSE. They need to
  439. // implement Extract member only if they decided to store the icon images
  440. // within files themselved or some other database (which is very rare).
  441. //
  442. //
  443. //
  444. // [Member functions]
  445. //
  446. //
  447. // IExtractIcon::GetIconLocation
  448. //
  449. //  This function returns an icon location.
  450. //
  451. //  Parameters:
  452. //   uFlags     [in]  -- Specifies if it is opened or not (GIL_OPENICON or 0)
  453. //   szIconFile [out] -- Specifies the string buffer buffer for a location name.
  454. //   cchMax     [in]  -- Specifies the size of szIconFile (almost always MAX_PATH)
  455. //   piIndex    [out] -- Sepcifies the address of UINT for the index.
  456. //   pwFlags    [out] -- Returns GIL_* flags
  457. //  Returns:
  458. //   NOERROR, if it returns a valid location; S_FALSE, if the shell use a
  459. //   default icon.
  460. //
  461. //  Notes: The location may or may not be a path to a file. The caller can
  462. //   not assume anything unless the subsequent Extract member call returns
  463. //   S_FALSE.
  464. //
  465. //   if the returned location is not a path to a file, GIL_NOTFILENAME should
  466. //   be set in the returned flags.
  467. //
  468. // IExtractIcon::Extract
  469. //
  470. //  This function extracts an icon image from a specified file.
  471. //
  472. //  Parameters:
  473. //   pszFile [in] -- Specifies the icon location (typically a path to a file).
  474. //   nIconIndex [in] -- Specifies the icon index.
  475. //   phiconLarge [out] -- Specifies the HICON variable for large icon.
  476. //   phiconSmall [out] -- Specifies the HICON variable for small icon.
  477. //   nIconSize [in] -- Specifies the size icon required (size of large icon)
  478. //                     LOWORD is the requested large icon size
  479. //                     HIWORD is the requested small icon size
  480. //  Returns:
  481. //   NOERROR, if it extracted the from the file.
  482. //   S_FALSE, if the caller should extract from the file specified in the
  483. //           location.
  484. //
  485. //===========================================================================
  486.  
  487. #undef  INTERFACE
  488. #define INTERFACE   IExtractIcon
  489.  
  490. // GetIconLocation() input flags
  491.  
  492. #define GIL_OPENICON     0x0001      // allows containers to specify an "open" look
  493. #define GIL_FORSHELL     0x0002      // icon is to be displayed in a ShellFolder
  494.  
  495. // GetIconLocation() return flags
  496.  
  497. #define GIL_SIMULATEDOC  0x0001      // simulate this document icon for this
  498. #define GIL_PERINSTANCE  0x0002      // icons from this class are per instance (each file has its own)
  499. #define GIL_PERCLASS     0x0004      // icons from this class per class (shared for all files of this type)
  500. #define GIL_NOTFILENAME  0x0008      // location is not a filename, must call ::Extract
  501. #define GIL_DONTCACHE    0x0010      // this icon should not be cached
  502.  
  503. DECLARE_INTERFACE_(IExtractIcon, IUnknown)    // exic
  504. {
  505.     // *** IUnknown methods ***
  506.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  507.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  508.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  509.  
  510.     // *** IExtractIcon methods ***
  511.     STDMETHOD(GetIconLocation)(THIS_
  512.                          UINT   uFlags,
  513.                          LPSTR  szIconFile,
  514.                          UINT   cchMax,
  515.                          int   * piIndex,
  516.                          UINT  * pwFlags) PURE;
  517.  
  518.     STDMETHOD(Extract)(THIS_
  519.                            LPCSTR pszFile,
  520.                UINT      nIconIndex,
  521.                HICON   *phiconLarge,
  522.                            HICON   *phiconSmall,
  523.                            UINT    nIconSize) PURE;
  524. };
  525.  
  526. typedef IExtractIcon *  LPEXTRACTICON;
  527.  
  528. //===========================================================================
  529. //
  530. // IShellLink Interface
  531. //
  532. //===========================================================================
  533.  
  534. // IShellLink::Resolve fFlags
  535. typedef enum {
  536.     SLR_NO_UI        = 0x0001,
  537.     SLR_ANY_MATCH    = 0x0002,
  538.     SLR_UPDATE          = 0x0004,
  539. } SLR_FLAGS;
  540.  
  541. // IShellLink::GetPath fFlags
  542. typedef enum {
  543.     SLGP_SHORTPATH    = 0x0001,
  544.     SLGP_UNCPRIORITY    = 0x0002,
  545. } SLGP_FLAGS;
  546.  
  547. #undef  INTERFACE
  548. #define INTERFACE   IShellLink
  549.  
  550. DECLARE_INTERFACE_(IShellLink, IUnknown)    // sl
  551. {
  552.     // *** IUnknown methods ***
  553.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  554.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  555.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  556.  
  557.     STDMETHOD(GetPath)(THIS_ LPSTR pszFile, int cchMaxPath, WIN32_FIND_DATA *pfd, DWORD fFlags) PURE;
  558.  
  559.     STDMETHOD(GetIDList)(THIS_ LPITEMIDLIST * ppidl) PURE;
  560.     STDMETHOD(SetIDList)(THIS_ LPCITEMIDLIST pidl) PURE;
  561.  
  562.     STDMETHOD(GetDescription)(THIS_ LPSTR pszName, int cchMaxName) PURE;
  563.     STDMETHOD(SetDescription)(THIS_ LPCSTR pszName) PURE;
  564.  
  565.     STDMETHOD(GetWorkingDirectory)(THIS_ LPSTR pszDir, int cchMaxPath) PURE;
  566.     STDMETHOD(SetWorkingDirectory)(THIS_ LPCSTR pszDir) PURE;
  567.  
  568.     STDMETHOD(GetArguments)(THIS_ LPSTR pszArgs, int cchMaxPath) PURE;
  569.     STDMETHOD(SetArguments)(THIS_ LPCSTR pszArgs) PURE;
  570.  
  571.     STDMETHOD(GetHotkey)(THIS_ WORD *pwHotkey) PURE;
  572.     STDMETHOD(SetHotkey)(THIS_ WORD wHotkey) PURE;
  573.  
  574.     STDMETHOD(GetShowCmd)(THIS_ int *piShowCmd) PURE;
  575.     STDMETHOD(SetShowCmd)(THIS_ int iShowCmd) PURE;
  576.  
  577.     STDMETHOD(GetIconLocation)(THIS_ LPSTR pszIconPath, int cchIconPath, int *piIcon) PURE;
  578.     STDMETHOD(SetIconLocation)(THIS_ LPCSTR pszIconPath, int iIcon) PURE;
  579.  
  580.     STDMETHOD(SetRelativePath)(THIS_ LPCSTR pszPathRel, DWORD dwReserved) PURE;
  581.  
  582.     STDMETHOD(Resolve)(THIS_ HWND hwnd, DWORD fFlags) PURE;
  583.  
  584.     STDMETHOD(SetPath)(THIS_ LPCSTR pszFile) PURE;
  585. };
  586.  
  587. //===========================================================================
  588. //
  589. // ICopyHook Interface
  590. //
  591. //
  592. //  The copy hook is called whenever file system directories are
  593. //  copy/moved/deleted/renamed via the shell.  It is also called by the shell
  594. //  on changes of status of printers.
  595. //
  596. //  Clients register their id under STRREG_SHEX_COPYHOOK for file system hooks
  597. //  and STRREG_SHEx_PRNCOPYHOOK for printer hooks.
  598. //  the CopyCallback is called prior to the action, so the hook has the chance
  599. //  to allow, deny or cancel the operation by returning the falues:
  600. //     IDYES  -  means allow the operation
  601. //     IDNO   -  means disallow the operation on this file, but continue with
  602. //              any other operations (eg. batch copy)
  603. //     IDCANCEL - means disallow the current operation and cancel any pending
  604. //              operations
  605. //
  606. //   arguments to the CopyCallback
  607. //      hwnd - window to use for any UI
  608. //      wFunc - what operation is being done
  609. //      wFlags - and flags (FOF_*) set in the initial call to the file operation
  610. //      pszSrcFile - name of the source file
  611. //      dwSrcAttribs - file attributes of the source file
  612. //      pszDestFile - name of the destiation file (for move and renames)
  613. //      dwDestAttribs - file attributes of the destination file
  614. //
  615. //
  616. //===========================================================================
  617.  
  618. #undef  INTERFACE
  619. #define INTERFACE   ICopyHook
  620.  
  621. #ifndef FO_MOVE //these need to be kept in sync with the ones in shellapi.h
  622.  
  623. // file operations
  624.  
  625. #define FO_MOVE           0x0001
  626. #define FO_COPY           0x0002
  627. #define FO_DELETE         0x0003
  628. #define FO_RENAME         0x0004
  629.  
  630. #define FOF_MULTIDESTFILES         0x0001
  631. #define FOF_CONFIRMMOUSE           0x0002
  632. #define FOF_SILENT                 0x0004  // don't create progress/report
  633. #define FOF_RENAMEONCOLLISION      0x0008
  634. #define FOF_NOCONFIRMATION         0x0010  // Don't prompt the user.
  635. #define FOF_WANTMAPPINGHANDLE      0x0020  // Fill in SHFILEOPSTRUCT.hNameMappings
  636.                                       // Must be freed using SHFreeNameMappings
  637. #define FOF_ALLOWUNDO              0x0040
  638. #define FOF_FILESONLY              0x0080  // on *.*, do only files
  639. #define FOF_SIMPLEPROGRESS         0x0100  // means don't show names of files
  640. #define FOF_NOCONFIRMMKDIR         0x0200  // don't confirm making any needed dirs
  641.  
  642. typedef UINT FILEOP_FLAGS;
  643.  
  644. // printer operations
  645.  
  646. #define PO_DELETE    0x0013  // printer is being deleted
  647. #define PO_RENAME    0x0014  // printer is being renamed
  648. #define PO_PORTCHANGE    0x0020  // port this printer connected to is being changed
  649.                 // if this id is set, the strings received by
  650.                 // the copyhook are a doubly-null terminated
  651.                 // list of strings.  The first is the printer
  652.                 // name and the second is the printer port.
  653. #define PO_REN_PORT    0x0034  // PO_RENAME and PO_PORTCHANGE at same time.
  654.  
  655. // no POF_ flags currently defined
  656.  
  657. typedef UINT PRINTEROP_FLAGS;
  658.  
  659. #endif // FO_MOVE                                
  660.  
  661. DECLARE_INTERFACE_(ICopyHook, IUnknown)    // sl
  662. {
  663.     // *** IUnknown methods ***
  664.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  665.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  666.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  667.  
  668.     STDMETHOD_(UINT,CopyCallback) (THIS_ HWND hwnd, UINT wFunc, UINT wFlags, LPCSTR pszSrcFile, DWORD dwSrcAttribs,
  669.                                    LPCSTR pszDestFile, DWORD dwDestAttribs) PURE;
  670. };
  671.  
  672. typedef ICopyHook *    LPCOPYHOOK;
  673.  
  674. //===========================================================================
  675. //
  676. // IFileViewerSite Interface
  677. //
  678. //===========================================================================
  679.  
  680. #undef  INTERFACE
  681. #define INTERFACE   IFileViewerSite
  682.  
  683. DECLARE_INTERFACE(IFileViewerSite)
  684. {
  685.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  686.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  687.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  688.  
  689.     STDMETHOD(SetPinnedWindow) (THIS_ HWND hwnd) PURE;
  690.     STDMETHOD(GetPinnedWindow) (THIS_ HWND *phwnd) PURE;
  691. };
  692.  
  693. typedef IFileViewerSite * LPFILEVIEWERSITE;
  694.  
  695. //===========================================================================
  696. //
  697. // IFileViewer Interface
  698. //
  699. // Implemented in a FileViewer component object.  Used to tell a
  700. // FileViewer to PrintTo or to view, the latter happening though
  701. // ShowInitialize and Show.  The filename is always given to the
  702. // viewer through IPersistFile.
  703. //
  704. //===========================================================================
  705.  
  706. #undef  INTERFACE
  707. #define INTERFACE   IFileViewer
  708.  
  709. typedef struct
  710. {
  711.     // Stuff passed into viewer (in)
  712.     DWORD cbSize;           // Size of structure for future expansion...
  713.     HWND hwndOwner;         // who is the owner window.
  714.     int iShow;              // The show command
  715.  
  716.     // Passed in and updated  (in/Out)
  717.     DWORD dwFlags;          // flags
  718.     RECT rect;              // Where to create the window may have defaults
  719.     LPUNKNOWN punkRel;      // Relese this interface when window is visible
  720.  
  721.     // Stuff that might be returned from viewer (out)
  722.     OLECHAR strNewFile[MAX_PATH];   // New File to view.
  723.  
  724. } FVSHOWINFO, *LPFVSHOWINFO;
  725.  
  726.     // Define File View Show Info Flags.
  727. #define FVSIF_RECT      0x00000001      // The rect variable has valid data.
  728. #define FVSIF_PINNED    0x00000002      // We should Initialize pinned
  729.  
  730. #define FVSIF_NEWFAILED 0x08000000      // The new file passed back failed
  731.                                         // to be viewed.
  732.  
  733. #define FVSIF_NEWFILE   0x80000000      // A new file to view has been returned
  734. #define FVSIF_CANVIEWIT 0x40000000      // The viewer can view it.
  735.  
  736. DECLARE_INTERFACE(IFileViewer)
  737. {
  738.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  739.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  740.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  741.  
  742.     STDMETHOD(ShowInitialize) (THIS_ LPFILEVIEWERSITE lpfsi) PURE;
  743.     STDMETHOD(Show) (THIS_ LPFVSHOWINFO pvsi) PURE;
  744.     STDMETHOD(PrintTo) (THIS_ LPSTR pszDriver, BOOL fSuppressUI) PURE;
  745. };
  746.  
  747. typedef IFileViewer * LPFILEVIEWER;
  748.  
  749. //--------------------------------------------------------------------------
  750. //
  751. // Command/menuitem IDs
  752. //
  753. //  The explorer dispatches WM_COMMAND messages based on the range of
  754. // command/menuitem IDs. All the IDs of menuitems that the view (right
  755. // pane) inserts must be in FCIDM_SHVIEWFIRST/LAST (otherwise, the explorer
  756. // won't dispatch them). The view should not deal with any menuitems
  757. // in FCIDM_BROWSERFIRST/LAST (otherwise, it won't work with the future
  758. // version of the shell).
  759. //
  760. //  FCIDM_SHVIEWFIRST/LAST      for the right pane (IShellView)
  761. //  FCIDM_BROWSERFIRST/LAST     for the explorer frame (IShellBrowser)
  762. //  FCIDM_GLOBAL/LAST           for the explorer's submenu IDs
  763. //
  764. //--------------------------------------------------------------------------
  765.  
  766. #define FCIDM_SHVIEWFIRST           0x0000
  767. #define FCIDM_SHVIEWLAST            0x7fff
  768. #define FCIDM_BROWSERFIRST          0xa000
  769. #define FCIDM_BROWSERLAST           0xbf00
  770. #define FCIDM_GLOBALFIRST           0x8000
  771. #define FCIDM_GLOBALLAST            0x9fff
  772.  
  773. //
  774. // Global submenu IDs and separator IDs
  775. //
  776. #define FCIDM_MENU_FILE             (FCIDM_GLOBALFIRST+0x0000)
  777. #define FCIDM_MENU_EDIT             (FCIDM_GLOBALFIRST+0x0040)
  778. #define FCIDM_MENU_VIEW             (FCIDM_GLOBALFIRST+0x0080)
  779. #define FCIDM_MENU_VIEW_SEP_OPTIONS (FCIDM_GLOBALFIRST+0x0081)
  780. #define FCIDM_MENU_TOOLS            (FCIDM_GLOBALFIRST+0x00c0)
  781. #define FCIDM_MENU_TOOLS_SEP_GOTO   (FCIDM_GLOBALFIRST+0x00c1)
  782. #define FCIDM_MENU_HELP             (FCIDM_GLOBALFIRST+0x0100)
  783. #define FCIDM_MENU_FIND             (FCIDM_GLOBALFIRST+0x0140)
  784. #define FCIDM_MENU_EXPLORE          (FCIDM_GLOBALFIRST+0x0150)
  785. #define FCIDM_MENU_FAVORITES        (FCIDM_GLOBALFIRST+0x0170)
  786.  
  787. #ifdef UNDER_CE
  788. //--------------------------------------------------------------------------
  789. // Pegasus Global Menu commands for all browser objects
  790. //   - These commands are used to dispatch commands through WM_COMMAND
  791. //     to all browser objects, If they don't wish to support these, then
  792. //     the menu item needs to be disabled.
  793. //--------------------------------------------------------------------------
  794.  
  795. #define FCIDM_MENU_DESKTOPSHORTCUT  (FCIDM_MENU_FILE+0x0000)
  796. #define FCIDM_MENU_DELETE           (FCIDM_MENU_FILE+0x0002)
  797. #define FCIDM_MENU_RENAME           (FCIDM_MENU_FILE+0x0004)
  798. #define FCIDM_MENU_PROPERTIES       (FCIDM_MENU_FILE+0x0008)
  799.  
  800. #endif
  801.  
  802.  
  803. //--------------------------------------------------------------------------
  804. // control IDs known to the view
  805. //--------------------------------------------------------------------------
  806.  
  807. #define FCIDM_TOOLBAR      (FCIDM_BROWSERFIRST + 0)
  808. #define FCIDM_STATUS       (FCIDM_BROWSERFIRST + 1)
  809.  
  810. //-------------------------------------------------------------------------
  811. //
  812. // struct STRRET
  813. //
  814. // structure for returning strings from IShellFolder member functions
  815. //
  816. //-------------------------------------------------------------------------
  817. #define STRRET_WSTR    0x0000
  818. #define STRRET_OFFSET    0x0001
  819. #define STRRET_CSTR    0x0002
  820.  
  821. typedef struct _STRRET
  822. {
  823.     UINT uType;    // One of the STRRET_* values
  824.     union
  825.     {
  826.         LPWSTR          pOleStr;        // OLESTR that will be freed
  827.         UINT            uOffset;        // Offset into SHITEMID (ANSI)
  828.         char            cStr[MAX_PATH]; // Buffer to fill in
  829.     } DUMMYUNIONNAME;
  830. } STRRET, *LPSTRRET;
  831.  
  832. //-------------------------------------------------------------------------
  833. //
  834. // SHGetPathFromIDList
  835. //
  836. //  This function assumes the size of the buffer (MAX_PATH). The pidl
  837. // should point to a file system object.
  838. //
  839. //-------------------------------------------------------------------------
  840.  
  841. WINSHELLAPI BOOL WINAPI SHGetPathFromIDList(LPCITEMIDLIST pidl, LPTSTR pszPath);
  842.  
  843. //-------------------------------------------------------------------------
  844. //
  845. // SHGetSpecialFolderLocation
  846. //
  847. //  Caller should call SHFree to free the returned pidl.
  848. //
  849. //-------------------------------------------------------------------------
  850. //
  851. // registry entries for special paths are kept in :
  852. #define REGSTR_PATH_SPECIAL_FOLDERS    REGSTR_PATH_EXPLORER "\\Shell Folders"
  853.  
  854. #define CSIDL_DESKTOP            0x0000
  855. #define CSIDL_PROGRAMS           0x0002
  856. #define CSIDL_CONTROLS           0x0003
  857. #define CSIDL_PRINTERS           0x0004
  858. #define CSIDL_PERSONAL           0x0005
  859. #define CSIDL_FAVORITES          0x0006
  860. #define CSIDL_STARTUP            0x0007
  861. #define CSIDL_RECENT             0x0008
  862. #define CSIDL_SENDTO             0x0009
  863. #define CSIDL_BITBUCKET          0x000a
  864. #define CSIDL_STARTMENU          0x000b
  865. #define CSIDL_DESKTOPDIRECTORY   0x0010
  866. #define CSIDL_DRIVES             0x0011        
  867. #define CSIDL_NETWORK            0x0012
  868. #define CSIDL_NETHOOD            0x0013
  869. #define CSIDL_FONTS         0x0014
  870. #define CSIDL_TEMPLATES          0x0015
  871.  
  872. WINSHELLAPI HRESULT WINAPI SHGetSpecialFolderLocation(HWND hwndOwner, int nFolder, LPITEMIDLIST * ppidl);
  873.  
  874. //-------------------------------------------------------------------------
  875. // old API get rid of it.
  876. //-------------------------------------------------------------------------
  877. WINSHELLAPI HICON WINAPI SHGetFileIcon(HINSTANCE hinst, LPCSTR pszPath, DWORD dwFileAttribute, UINT uFlags);
  878.  
  879. //-------------------------------------------------------------------------
  880. //
  881. // SHBrowseForFolder API
  882. //
  883. //-------------------------------------------------------------------------
  884.  
  885. typedef int (CALLBACK* BFFCALLBACK)(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData);
  886.  
  887. typedef struct _browseinfo {
  888.     HWND        hwndOwner;
  889.     LPCITEMIDLIST pidlRoot;
  890.     LPSTR        pszDisplayName;// Return display name of item selected.
  891.     LPCSTR       lpszTitle;      // text to go in the banner over the tree.
  892.     UINT         ulFlags;       // Flags that control the return stuff
  893.     BFFCALLBACK  lpfn;
  894.     LPARAM      lParam;         // extra info that's passed back in callbacks
  895.  
  896.     int          iImage;      // output var: where to return the Image index.
  897. } BROWSEINFO, *PBROWSEINFO, *LPBROWSEINFO;
  898.  
  899. // Browsing for directory.
  900. #define BIF_RETURNONLYFSDIRS   0x0001  // For finding a folder to start document searching
  901. #define BIF_DONTGOBELOWDOMAIN  0x0002  // For starting the Find Computer
  902. #define BIF_STATUSTEXT         0x0004
  903. #define BIF_RETURNFSANCESTORS  0x0008
  904.  
  905. #define BIF_BROWSEFORCOMPUTER  0x1000  // Browsing for Computers.
  906. #define BIF_BROWSEFORPRINTER   0x2000  // Browsing for Printers
  907.  
  908. // message from browse
  909. #define BFFM_INITIALIZED        1
  910. #define BFFM_SELCHANGED         2
  911.  
  912. // messages to browse
  913. #define BFFM_SETSTATUSTEXT      (WM_USER + 100)
  914. #define BFFM_ENABLEOK           (WM_USER + 101)
  915.  
  916. WINSHELLAPI LPITEMIDLIST WINAPI SHBrowseForFolder(LPBROWSEINFO lpbi);
  917.  
  918. //-------------------------------------------------------------------------
  919. //
  920. // SHLoadInProc
  921. //
  922. //   When this function is called, the shell calls CoCreateInstance
  923. //  (or equivalent) with CLSCTX_INPROC_SERVER and the specified CLSID
  924. //  from within the shell's process and release it immediately.
  925. //
  926. //-------------------------------------------------------------------------
  927.  
  928. WINSHELLAPI HRESULT WINAPI SHLoadInProc(REFCLSID rclsid);
  929.  
  930. //-------------------------------------------------------------------------
  931. //
  932. // IEnumIDList interface
  933. //
  934. //  IShellFolder::EnumObjects member returns an IEnumIDList object.
  935. //
  936. //-------------------------------------------------------------------------
  937.  
  938. typedef struct IEnumIDList    *LPENUMIDLIST;
  939.  
  940. #undef     INTERFACE
  941. #define    INTERFACE     IEnumIDList
  942.  
  943. DECLARE_INTERFACE_(IEnumIDList, IUnknown)
  944. {                        
  945.     // *** IUnknown methods ***
  946.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  947.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  948.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  949.  
  950.     // *** IEnumIDList methods ***
  951.     STDMETHOD(Next)  (THIS_ ULONG celt,
  952.               LPITEMIDLIST *rgelt,
  953.               ULONG *pceltFetched) PURE;
  954.     STDMETHOD(Skip)  (THIS_ ULONG celt) PURE;
  955.     STDMETHOD(Reset) (THIS) PURE;
  956.     STDMETHOD(Clone) (THIS_ IEnumIDList **ppenum) PURE;
  957. };
  958.  
  959. //-------------------------------------------------------------------------
  960. //
  961. // IShellFolder interface
  962. //
  963. //
  964. // [Member functions]
  965. //
  966. // IShellFolder::BindToObject(pidl, pbc, riid, ppvOut)
  967. //   This function returns an instance of a sub-folder which is specified
  968. //  by the IDList (pidl).
  969. //
  970. // IShellFolder::BindToStorage(pidl, pbc, riid, ppvObj)
  971. //   This function returns a storage instance of a sub-folder which is
  972. //  specified by the IDList (pidl). The shell never calls this member
  973. //  function in the first release of Chicago.
  974. //
  975. // IShellFolder::CompareIDs(lParam, pidl1, pidl2)
  976. //   This function compares two IDLists and returns the result. The shell
  977. //  explorer always passes 0 as lParam, which indicates "sort by name".
  978. //  It should return 0 (as CODE of the scode), if two id indicates the
  979. //  same object; negative value if pidl1 should be placed before pidl2;
  980. //  positive value if pidl2 should be placed before pidl1.
  981. //
  982. // IShellFolder::CreateViewObject(hwndOwner, riid, ppvOut)
  983. //   This function creates a view object of the folder itself. The view
  984. //  object is a difference instance from the shell folder object.
  985. //
  986. // IShellFolder::GetAttributesOf(cidl, apidl, prgfInOut)
  987. //   This function returns the attributes of specified objects in that
  988. //  folder. "cidl" and "apidl" specifies objects. "apidl" contains only
  989. //  simple IDLists. The explorer initializes *prgfInOut with a set of
  990. //  flags to be evaluated. The shell folder may optimize the operation
  991. //  by not returning unspecified flags.
  992. //
  993. // IShellFolder::GetUIObjectOf(hwndOwner, cidl, apidl, riid, prgfInOut, ppvOut)
  994. //   This function creates a UI object to be used for specified objects.
  995. //  The shell explorer passes either IID_IDataObject (for transfer operation)
  996. //  or IID_IContextMenu (for context menu operation) as riid.
  997. //
  998. // IShellFolder::GetDisplayNameOf
  999. //   This function returns the display name of the specified object.
  1000. //  If the ID contains the display name (in the locale character set),
  1001. //  it returns the offset to the name. Otherwise, it returns a pointer
  1002. //  to the display name string (UNICODE), which is allocated by the
  1003. //  task allocator, or fills in a buffer.
  1004. //
  1005. // IShellFolder::SetNameOf
  1006. //   This function sets the display name of the specified object.
  1007. //  If it changes the ID as well, it returns the new ID which is
  1008. //  alocated by the task allocator.
  1009. //
  1010. //-------------------------------------------------------------------------
  1011.  
  1012. #undef     INTERFACE
  1013. #define    INTERFACE     IShellFolder
  1014.  
  1015. // IShellFolder::GetDisplayNameOf/SetNameOf uFlags
  1016. typedef enum tagSHGDN
  1017. {
  1018.     SHGDN_NORMAL        = 0,    // default (display purpose)
  1019.     SHGDN_INFOLDER          = 1,        // displayed under a folder (relative)
  1020.     SHGDN_FORPARSING        = 0x8000,   // for ParseDisplayName or path
  1021. } SHGNO;
  1022.  
  1023. // IShellFolder::EnumObjects
  1024. typedef enum tagSHCONTF
  1025. {
  1026.     SHCONTF_FOLDERS         = 32,    // for shell browser
  1027.     SHCONTF_NONFOLDERS      = 64,    // for default view
  1028.     SHCONTF_INCLUDEHIDDEN   = 128,    // for hidden/system objects
  1029. } SHCONTF;
  1030.  
  1031. // IShellFolder::GetAttributesOf flags
  1032. #define SFGAO_CANCOPY           DROPEFFECT_COPY // Objects can be copied
  1033. #define SFGAO_CANMOVE           DROPEFFECT_MOVE // Objects can be moved
  1034. #define SFGAO_CANLINK           DROPEFFECT_LINK // Objects can be linked
  1035. #define SFGAO_CANRENAME         0x00000010L     // Objects can be renamed
  1036. #define SFGAO_CANDELETE         0x00000020L     // Objects can be deleted
  1037. #define SFGAO_HASPROPSHEET      0x00000040L     // Objects have property sheets
  1038. #define SFGAO_DROPTARGET    0x00000100L    // Objects are drop target
  1039. #define SFGAO_CAPABILITYMASK    0x00000177L
  1040. #define SFGAO_LINK              0x00010000L     // Shortcut (link)
  1041. #define SFGAO_SHARE             0x00020000L     // shared
  1042. #define SFGAO_READONLY          0x00040000L     // read-only
  1043. #define SFGAO_GHOSTED           0x00080000L     // ghosted icon
  1044. #define SFGAO_DISPLAYATTRMASK   0x000F0000L
  1045. #define SFGAO_FILESYSANCESTOR   0x10000000L     // It contains file system folder
  1046. #define SFGAO_FOLDER            0x20000000L     // It's a folder.
  1047. #define SFGAO_FILESYSTEM        0x40000000L     // is a file system thing (file/folder/root)
  1048. #define SFGAO_HASSUBFOLDER      0x80000000L     // Expandable in the map pane
  1049. #define SFGAO_CONTENTSMASK      0x80000000L
  1050. #define SFGAO_VALIDATE          0x01000000L     // invalidate cached information
  1051. #define SFGAO_REMOVABLE        0x02000000L     // is this removeable media?
  1052.  
  1053. DECLARE_INTERFACE_(IShellFolder, IUnknown)
  1054. {                        
  1055.     // *** IUnknown methods ***
  1056.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  1057.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  1058.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  1059.  
  1060.     // *** IShellFolder methods ***
  1061.     STDMETHOD(ParseDisplayName) (THIS_ HWND hwndOwner,
  1062.     LPBC pbcReserved, LPOLESTR lpszDisplayName,
  1063.         ULONG * pchEaten, LPITEMIDLIST * ppidl, ULONG *pdwAttributes) PURE;
  1064.  
  1065.     STDMETHOD(EnumObjects) ( THIS_ HWND hwndOwner, DWORD grfFlags, LPENUMIDLIST * ppenumIDList) PURE;
  1066.  
  1067.     STDMETHOD(BindToObject)     (THIS_ LPCITEMIDLIST pidl, LPBC pbcReserved,
  1068.                  REFIID riid, LPVOID * ppvOut) PURE;
  1069.     STDMETHOD(BindToStorage)    (THIS_ LPCITEMIDLIST pidl, LPBC pbcReserved,
  1070.                  REFIID riid, LPVOID * ppvObj) PURE;
  1071.     STDMETHOD(CompareIDs)       (THIS_ LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2) PURE;
  1072.     STDMETHOD(CreateViewObject) (THIS_ HWND hwndOwner, REFIID riid, LPVOID * ppvOut) PURE;
  1073.     STDMETHOD(GetAttributesOf)  (THIS_ UINT cidl, LPCITEMIDLIST * apidl,
  1074.                     ULONG * rgfInOut) PURE;
  1075.     STDMETHOD(GetUIObjectOf)    (THIS_ HWND hwndOwner, UINT cidl, LPCITEMIDLIST * apidl,
  1076.                          REFIID riid, UINT * prgfInOut, LPVOID * ppvOut) PURE;
  1077.     STDMETHOD(GetDisplayNameOf) (THIS_ LPCITEMIDLIST pidl, DWORD uFlags, LPSTRRET lpName) PURE;
  1078.     STDMETHOD(SetNameOf)        (THIS_ HWND hwndOwner, LPCITEMIDLIST pidl,
  1079.                  LPCOLESTR lpszName, DWORD uFlags,
  1080.                  LPITEMIDLIST * ppidlOut) PURE;
  1081. };
  1082.  
  1083. typedef IShellFolder * LPSHELLFOLDER;
  1084.  
  1085. //
  1086. //  Helper function which returns a IShellFolder interface to the desktop
  1087. // folder. This is equivalent to call CoCreateInstance with CLSID_ShellDesktop.
  1088. //
  1089. //  CoCreateInstance(CLSID_Desktop, NULL,
  1090. //                   CLSCTX_INPROC, IID_IShellFolder, &pshf);
  1091. //
  1092. WINSHELLAPI HRESULT WINAPI SHGetDesktopFolder(LPSHELLFOLDER *ppshf);
  1093.  
  1094.  
  1095. //====== File System Notification APIs ===============================
  1096. //
  1097.  
  1098. //
  1099. //  File System Notification flags
  1100. //
  1101.  
  1102. #define SHCNE_RENAME              0x00000001L   // GOING AWAY
  1103. #define SHCNE_RENAMEITEM          0x00000001L
  1104. #define SHCNE_CREATE              0x00000002L
  1105. #define SHCNE_DELETE              0x00000004L
  1106. #define SHCNE_MKDIR                  0x00000008L
  1107. #define SHCNE_RMDIR               0x00000010L
  1108. #define SHCNE_MEDIAINSERTED       0x00000020L
  1109. #define SHCNE_MEDIAREMOVED        0x00000040L
  1110. #define SHCNE_DRIVEREMOVED        0x00000080L
  1111. #define SHCNE_DRIVEADD            0x00000100L
  1112. #define SHCNE_NETSHARE            0x00000200L
  1113. #define SHCNE_NETUNSHARE          0x00000400L
  1114. #define SHCNE_ATTRIBUTES          0x00000800L
  1115. #define SHCNE_UPDATEDIR           0x00001000L
  1116. #define SHCNE_UPDATEITEM          0x00002000L
  1117. #define SHCNE_SERVERDISCONNECT    0x00004000L
  1118. #define SHCNE_UPDATEIMAGE         0x00008000L
  1119. #define SHCNE_DRIVEADDGUI         0x00010000L
  1120. #define SHCNE_RENAMEFOLDER        0x00020000L
  1121.  
  1122. #define SHCNE_ASSOCCHANGED        0x08000000L
  1123.  
  1124. #define SHCNE_DISKEVENTS          0x0002381FL
  1125. #define SHCNE_GLOBALEVENTS        0x0C0181E0L // Events that dont match pidls first
  1126. #define SHCNE_ALLEVENTS           0x7FFFFFFFL
  1127. #define SHCNE_INTERRUPT           0x80000000L // The presence of this flag indicates
  1128.                                             // that the event was generated by an
  1129.                                             // interrupt.  It is stripped out before
  1130.                                             // the clients of SHCNNotify_ see it.
  1131.  
  1132. // Flags
  1133. // uFlags & SHCNF_TYPE is an ID which indicates what dwItem1 and dwItem2 mean
  1134. #define SHCNF_IDLIST      0x0000    // LPITEMIDLIST
  1135. #define SHCNF_PATH        0x0001    // path name
  1136. #define SHCNF_PRINTER     0x0002    // printer friendly name
  1137. #define SHCNF_DWORD       0x0003    // DWORD
  1138. #define SHCNF_TYPE        0x00FF
  1139. #define SHCNF_FLUSH       0x1000
  1140. #define SHCNF_FLUSHNOWAIT 0x2000
  1141.  
  1142. //
  1143. //  APIs
  1144. //
  1145. WINSHELLAPI void WINAPI SHChangeNotify(LONG wEventId, UINT uFlags,
  1146.                 LPCVOID dwItem1, LPCVOID dwItem2);
  1147.  
  1148. //
  1149. // SHAddToRecentDocs
  1150. //
  1151. #define SHARD_PIDL    0x00000001L
  1152. #define SHARD_PATH      0x00000002L
  1153.  
  1154. WINSHELLAPI HRESULT WINAPI SHGetInstanceExplorer(IUnknown **ppunk);
  1155.  
  1156. #ifdef __cplusplus
  1157. }
  1158.  
  1159. #endif  /* __cplusplus */
  1160.  
  1161. #ifndef RC_INVOKED
  1162. #pragma pack()
  1163. #endif  /* !RC_INVOKED */
  1164.  
  1165. #endif // _SHLOBJ_H_
  1166.  
  1167.