Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3509 lines
125 KiB

  1. //===========================================================================
  2. //
  3. // Copyright (c) Microsoft Corporation 1991-1997
  4. //
  5. // File: shlobj.h
  6. //
  7. //===========================================================================
  8. #ifndef _SHLOBJ_H_
  9. #define _SHLOBJ_H_
  10. #ifndef SNDMSG
  11. #ifdef __cplusplus
  12. #define SNDMSG ::SendMessage
  13. #else
  14. #define SNDMSG SendMessage
  15. #endif
  16. #endif // ifndef SNDMSG
  17. //
  18. // Define API decoration for direct importing of DLL references.
  19. //
  20. #ifndef WINSHELLAPI
  21. #if !defined(_SHELL32_)
  22. #define WINSHELLAPI DECLSPEC_IMPORT
  23. #else
  24. #define WINSHELLAPI
  25. #endif
  26. #endif // WINSHELLAPI
  27. #ifndef SHSTDAPI
  28. #if !defined(_SHELL32_)
  29. #define SHSTDAPI EXTERN_C DECLSPEC_IMPORT HRESULT STDAPICALLTYPE
  30. #define SHSTDAPI_(type) EXTERN_C DECLSPEC_IMPORT type STDAPICALLTYPE
  31. #else
  32. #define SHSTDAPI STDAPI
  33. #define SHSTDAPI_(type) STDAPI_(type)
  34. #endif
  35. #endif // SHSTDAPI
  36. #ifndef SHDOCAPI
  37. #if !defined(_SHDOCVW_)
  38. #define SHDOCAPI EXTERN_C DECLSPEC_IMPORT HRESULT STDAPICALLTYPE
  39. #define SHDOCAPI_(type) EXTERN_C DECLSPEC_IMPORT type STDAPICALLTYPE
  40. #else
  41. #define SHDOCAPI STDAPI
  42. #define SHDOCAPI_(type) STDAPI_(type)
  43. #endif
  44. #endif // SHDOCAPI
  45. #include <ole2.h>
  46. #ifndef _PRSHT_H_
  47. #include <prsht.h>
  48. #endif
  49. #ifndef _INC_COMMCTRL
  50. #include <commctrl.h> // for LPTBBUTTON
  51. #endif
  52. #ifndef INITGUID
  53. #include <shlguid.h>
  54. #endif /* !INITGUID */
  55. #ifndef RC_INVOKED
  56. #pragma pack(1) /* Assume byte packing throughout */
  57. #endif /* !RC_INVOKED */
  58. #ifdef __cplusplus
  59. extern "C" { /* Assume C declarations for C++ */
  60. #endif /* __cplusplus */
  61. //===========================================================================
  62. //
  63. // Object identifiers in the explorer's name space (ItemID and IDList)
  64. //
  65. // All the items that the user can browse with the explorer (such as files,
  66. // directories, servers, work-groups, etc.) has an identifier which is unique
  67. // among items within the parent folder. Those identifiers are called item
  68. // IDs (SHITEMID). Since all its parent folders have their own item IDs,
  69. // any items can be uniquely identified by a list of item IDs, which is called
  70. // an ID list (ITEMIDLIST).
  71. //
  72. // ID lists are almost always allocated by the task allocator (see some
  73. // description below as well as OLE 2.0 SDK) and may be passed across
  74. // some of shell interfaces (such as IShellFolder). Each item ID in an ID list
  75. // is only meaningful to its parent folder (which has generated it), and all
  76. // the clients must treat it as an opaque binary data except the first two
  77. // bytes, which indicates the size of the item ID.
  78. //
  79. // When a shell extension -- which implements the IShellFolder interace --
  80. // generates an item ID, it may put any information in it, not only the data
  81. // with that it needs to identifies the item, but also some additional
  82. // information, which would help implementing some other functions efficiently.
  83. // For example, the shell's IShellFolder implementation of file system items
  84. // stores the primary (long) name of a file or a directory as the item
  85. // identifier, but it also stores its alternative (short) name, size and date
  86. // etc.
  87. //
  88. // When an ID list is passed to one of shell APIs (such as SHGetPathFromIDList),
  89. // it is always an absolute path -- relative from the root of the name space,
  90. // which is the desktop folder. When an ID list is passed to one of IShellFolder
  91. // member function, it is always a relative path from the folder (unless it
  92. // is explicitly specified).
  93. //
  94. //===========================================================================
  95. //
  96. // SHITEMID -- Item ID
  97. //
  98. typedef struct _SHITEMID // mkid
  99. {
  100. USHORT cb; // Size of the ID (including cb itself)
  101. BYTE abID[1]; // The item ID (variable length)
  102. } SHITEMID;
  103. typedef UNALIGNED SHITEMID *LPSHITEMID;
  104. typedef const UNALIGNED SHITEMID *LPCSHITEMID;
  105. //
  106. // ITEMIDLIST -- List if item IDs (combined with 0-terminator)
  107. //
  108. typedef struct _ITEMIDLIST // idl
  109. {
  110. SHITEMID mkid;
  111. } ITEMIDLIST;
  112. typedef UNALIGNED ITEMIDLIST * LPITEMIDLIST;
  113. typedef const UNALIGNED ITEMIDLIST * LPCITEMIDLIST;
  114. //===========================================================================
  115. //
  116. // Task allocator API
  117. //
  118. // All the shell extensions MUST use the task allocator (see OLE 2.0
  119. // programming guild for its definition) when they allocate or free
  120. // memory objects (mostly ITEMIDLIST) that are returned across any
  121. // shell interfaces. There are two ways to access the task allocator
  122. // from a shell extension depending on whether or not it is linked with
  123. // OLE32.DLL or not (purely for efficiency).
  124. //
  125. // (1) A shell extension which calls any OLE API (i.e., linked with
  126. // OLE32.DLL) should call OLE's task allocator (by retrieving
  127. // the task allocator by calling CoGetMalloc API).
  128. //
  129. // (2) A shell extension which does not call any OLE API (i.e., not linked
  130. // with OLE32.DLL) should call the shell task allocator API (defined
  131. // below), so that the shell can quickly loads it when OLE32.DLL is not
  132. // loaded by any application at that point.
  133. //
  134. // Notes:
  135. // In next version of Windowso release, SHGetMalloc will be replaced by
  136. // the following macro.
  137. //
  138. // #define SHGetMalloc(ppmem) CoGetMalloc(MEMCTX_TASK, ppmem)
  139. //
  140. //===========================================================================
  141. WINSHELLAPI HRESULT WINAPI SHGetMalloc(LPMALLOC * ppMalloc);
  142. //===========================================================================
  143. //
  144. // IContextMenu interface
  145. //
  146. // [OverView]
  147. //
  148. // The shell uses the IContextMenu interface in following three cases.
  149. //
  150. // case-1: The shell is loading context menu extensions.
  151. //
  152. // When the user clicks the right mouse button on an item within the shell's
  153. // name space (i.g., file, directory, server, work-group, etc.), it creates
  154. // the default context menu for its type, then loads context menu extensions
  155. // that are registered for that type (and its base type) so that they can
  156. // add extra menu items. Those context menu extensions are registered at
  157. // HKCR\{ProgID}\shellex\ContextMenuHandlers.
  158. //
  159. // case-2: The shell is retrieving a context menu of sub-folders in extended
  160. // name-space.
  161. //
  162. // When the explorer's name space is extended by name space extensions,
  163. // the shell calls their IShellFolder::GetUIObjectOf to get the IContextMenu
  164. // objects when it creates context menus for folders under those extended
  165. // name spaces.
  166. //
  167. // case-3: The shell is loading non-default drag and drop handler for directories.
  168. //
  169. // When the user performed a non-default drag and drop onto one of file
  170. // system folders (i.e., directories), it loads shell extensions that are
  171. // registered at HKCR\{ProgID}\DragDropHandlers.
  172. //
  173. //
  174. // [Member functions]
  175. //
  176. //
  177. // IContextMenu::QueryContextMenu
  178. //
  179. // This member function may insert one or more menuitems to the specified
  180. // menu (hmenu) at the specified location (indexMenu which is never be -1).
  181. // The IDs of those menuitem must be in the specified range (idCmdFirst and
  182. // idCmdLast). It returns the maximum menuitem ID offset (ushort) in the
  183. // 'code' field (low word) of the scode.
  184. //
  185. // The uFlags specify the context. It may have one or more of following
  186. // flags.
  187. //
  188. // CMF_DEFAULTONLY: This flag is passed if the user is invoking the default
  189. // action (typically by double-clicking, case 1 and 2 only). Context menu
  190. // extensions (case 1) should not add any menu items, and returns NOERROR.
  191. //
  192. // CMF_VERBSONLY: The explorer passes this flag if it is constructing
  193. // a context menu for a short-cut object (case 1 and case 2 only). If this
  194. // flag is passed, it should not add any menu-items that is not appropriate
  195. // from a short-cut.
  196. // A good example is the "Delete" menuitem, which confuses the user
  197. // because it is not clear whether it deletes the link source item or the
  198. // link itself.
  199. //
  200. // CMF_EXPLORER: The explorer passes this flag if it has the left-side pane
  201. // (case 1 and 2 only). Context menu extensions should ignore this flag.
  202. //
  203. // High word (16-bit) are reserved for context specific communications
  204. // and the rest of flags (13-bit) are reserved by the system.
  205. //
  206. //
  207. // IContextMenu::InvokeCommand
  208. //
  209. // This member is called when the user has selected one of menuitems that
  210. // are inserted by previous QueryContextMenu member. In this case, the
  211. // LOWORD(lpici->lpVerb) contains the menuitem ID offset (menuitem ID -
  212. // idCmdFirst).
  213. //
  214. // This member function may also be called programmatically. In such a case,
  215. // lpici->lpVerb specifies the canonical name of the command to be invoked,
  216. // which is typically retrieved by GetCommandString member previously.
  217. //
  218. // Parameters in lpci:
  219. // cbSize -- Specifies the size of this structure (sizeof(*lpci))
  220. // hwnd -- Specifies the owner window for any message/dialog box.
  221. // fMask -- Specifies whether or not dwHotkey/hIcon paramter is valid.
  222. // lpVerb -- Specifies the command to be invoked.
  223. // lpParameters -- Parameters (optional)
  224. // lpDirectory -- Working directory (optional)
  225. // nShow -- Specifies the flag to be passed to ShowWindow (SW_*).
  226. // dwHotKey -- Hot key to be assigned to the app after invoked (optional).
  227. // hIcon -- Specifies the icon (optional).
  228. // hMonitor -- Specifies the default monitor (optional).
  229. //
  230. //
  231. // IContextMenu::GetCommandString
  232. //
  233. // This member function is called by the explorer either to get the
  234. // canonical (language independent) command name (uFlags == GCS_VERB) or
  235. // the help text ((uFlags & GCS_HELPTEXT) != 0) for the specified command.
  236. // The retrieved canonical string may be passed to its InvokeCommand
  237. // member function to invoke a command programmatically. The explorer
  238. // displays the help texts in its status bar; therefore, the length of
  239. // the help text should be reasonably short (<40 characters).
  240. //
  241. // Parameters:
  242. // idCmd -- Specifies menuitem ID offset (from idCmdFirst)
  243. // uFlags -- Either GCS_VERB or GCS_HELPTEXT
  244. // pwReserved -- Reserved (must pass NULL when calling, must ignore when called)
  245. // pszName -- Specifies the string buffer.
  246. // cchMax -- Specifies the size of the string buffer.
  247. //
  248. //===========================================================================
  249. // QueryContextMenu uFlags
  250. #define CMF_NORMAL 0x00000000
  251. #define CMF_DEFAULTONLY 0x00000001
  252. #define CMF_VERBSONLY 0x00000002
  253. #define CMF_EXPLORE 0x00000004
  254. #define CMF_NOVERBS 0x00000008
  255. #define CMF_CANRENAME 0x00000010
  256. #define CMF_NODEFAULT 0x00000020
  257. #define CMF_INCLUDESTATIC 0x00000040
  258. #define CMF_RESERVED 0xffff0000 // View specific
  259. // GetCommandString uFlags
  260. #define GCS_VERBA 0x00000000 // canonical verb
  261. #define GCS_HELPTEXTA 0x00000001 // help text (for status bar)
  262. #define GCS_VALIDATEA 0x00000002 // validate command exists
  263. #define GCS_VERBW 0x00000004 // canonical verb (unicode)
  264. #define GCS_HELPTEXTW 0x00000005 // help text (unicode version)
  265. #define GCS_VALIDATEW 0x00000006 // validate command exists (unicode)
  266. #define GCS_UNICODE 0x00000004 // for bit testing - Unicode string
  267. #ifdef UNICODE
  268. #define GCS_VERB GCS_VERBW
  269. #define GCS_HELPTEXT GCS_HELPTEXTW
  270. #define GCS_VALIDATE GCS_VALIDATEW
  271. #else
  272. #define GCS_VERB GCS_VERBA
  273. #define GCS_HELPTEXT GCS_HELPTEXTA
  274. #define GCS_VALIDATE GCS_VALIDATEA
  275. #endif
  276. #define CMDSTR_NEWFOLDERA "NewFolder"
  277. #define CMDSTR_VIEWLISTA "ViewList"
  278. #define CMDSTR_VIEWDETAILSA "ViewDetails"
  279. #define CMDSTR_NEWFOLDERW L"NewFolder"
  280. #define CMDSTR_VIEWLISTW L"ViewList"
  281. #define CMDSTR_VIEWDETAILSW L"ViewDetails"
  282. #ifdef UNICODE
  283. #define CMDSTR_NEWFOLDER CMDSTR_NEWFOLDERW
  284. #define CMDSTR_VIEWLIST CMDSTR_VIEWLISTW
  285. #define CMDSTR_VIEWDETAILS CMDSTR_VIEWDETAILSW
  286. #else
  287. #define CMDSTR_NEWFOLDER CMDSTR_NEWFOLDERA
  288. #define CMDSTR_VIEWLIST CMDSTR_VIEWLISTA
  289. #define CMDSTR_VIEWDETAILS CMDSTR_VIEWDETAILSA
  290. #endif
  291. #define CMIC_MASK_HOTKEY SEE_MASK_HOTKEY
  292. #define CMIC_MASK_ICON SEE_MASK_ICON
  293. #define CMIC_MASK_FLAG_NO_UI SEE_MASK_FLAG_NO_UI
  294. #define CMIC_MASK_UNICODE SEE_MASK_UNICODE
  295. #define CMIC_MASK_NO_CONSOLE SEE_MASK_NO_CONSOLE
  296. #define CMIC_MASK_HASLINKNAME SEE_MASK_HASLINKNAME
  297. #define CMIC_MASK_FLAG_SEP_VDM SEE_MASK_FLAG_SEPVDM
  298. #define CMIC_MASK_HASTITLE SEE_MASK_HASTITLE
  299. #define CMIC_MASK_ASYNCOK SEE_MASK_ASYNCOK
  300. #if (_WIN32_IE >= 0x0400)
  301. #define CMIC_MASK_PTINVOKE 0x20000000
  302. #endif
  303. //NOTE: When SEE_MASK_HMONITOR is set, hIcon is treated as hMonitor
  304. typedef struct _CMINVOKECOMMANDINFO {
  305. DWORD cbSize; // sizeof(CMINVOKECOMMANDINFO)
  306. DWORD fMask; // any combination of CMIC_MASK_*
  307. HWND hwnd; // might be NULL (indicating no owner window)
  308. LPCSTR lpVerb; // either a string or MAKEINTRESOURCE(idOffset)
  309. LPCSTR lpParameters; // might be NULL (indicating no parameter)
  310. LPCSTR lpDirectory; // might be NULL (indicating no specific directory)
  311. int nShow; // one of SW_ values for ShowWindow() API
  312. DWORD dwHotKey;
  313. HANDLE hIcon;
  314. } CMINVOKECOMMANDINFO, *LPCMINVOKECOMMANDINFO;
  315. typedef struct _CMInvokeCommandInfoEx {
  316. DWORD cbSize; // must be sizeof(CMINVOKECOMMANDINFOEX)
  317. DWORD fMask; // any combination of CMIC_MASK_*
  318. HWND hwnd; // might be NULL (indicating no owner window)
  319. LPCSTR lpVerb; // either a string or MAKEINTRESOURCE(idOffset)
  320. LPCSTR lpParameters; // might be NULL (indicating no parameter)
  321. LPCSTR lpDirectory; // might be NULL (indicating no specific directory)
  322. int nShow; // one of SW_ values for ShowWindow() API
  323. DWORD dwHotKey;
  324. HANDLE hIcon;
  325. LPCSTR lpTitle; // For CreateProcess-StartupInfo.lpTitle
  326. LPCWSTR lpVerbW; // Unicode verb (for those who can use it)
  327. LPCWSTR lpParametersW; // Unicode parameters (for those who can use it)
  328. LPCWSTR lpDirectoryW; // Unicode directory (for those who can use it)
  329. LPCWSTR lpTitleW; // Unicode title (for those who can use it)
  330. #if (_WIN32_IE >= 0x0400)
  331. POINT ptInvoke; // Point where it's invoked
  332. #endif
  333. } CMINVOKECOMMANDINFOEX, *LPCMINVOKECOMMANDINFOEX;
  334. #undef INTERFACE
  335. #define INTERFACE IContextMenu
  336. DECLARE_INTERFACE_(IContextMenu, IUnknown)
  337. {
  338. // *** IUnknown methods ***
  339. STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  340. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  341. STDMETHOD_(ULONG,Release) (THIS) PURE;
  342. STDMETHOD(QueryContextMenu)(THIS_
  343. HMENU hmenu,
  344. UINT indexMenu,
  345. UINT idCmdFirst,
  346. UINT idCmdLast,
  347. UINT uFlags) PURE;
  348. STDMETHOD(InvokeCommand)(THIS_
  349. LPCMINVOKECOMMANDINFO lpici) PURE;
  350. STDMETHOD(GetCommandString)(THIS_
  351. UINT idCmd,
  352. UINT uType,
  353. UINT * pwReserved,
  354. LPSTR pszName,
  355. UINT cchMax) PURE;
  356. };
  357. typedef IContextMenu * LPCONTEXTMENU;
  358. //
  359. // IContextMenu2 (IContextMenu with one new member)
  360. //
  361. // IContextMenu2::HandleMenuMsg
  362. //
  363. // This function is called, if the client of IContextMenu is aware of
  364. // IContextMenu2 interface and receives one of following messages while
  365. // it is calling TrackPopupMenu (in the window proc of hwndOwner):
  366. // WM_INITPOPUP, WM_DRAWITEM and WM_MEASUREITEM
  367. // The callee may handle these messages to draw owner draw menuitems.
  368. //
  369. #undef INTERFACE
  370. #define INTERFACE IContextMenu2
  371. DECLARE_INTERFACE_(IContextMenu2, IContextMenu)
  372. {
  373. // *** IUnknown methods ***
  374. STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  375. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  376. STDMETHOD_(ULONG,Release) (THIS) PURE;
  377. // *** IContextMenu methods ***
  378. STDMETHOD(QueryContextMenu)(THIS_
  379. HMENU hmenu,
  380. UINT indexMenu,
  381. UINT idCmdFirst,
  382. UINT idCmdLast,
  383. UINT uFlags) PURE;
  384. STDMETHOD(InvokeCommand)(THIS_
  385. LPCMINVOKECOMMANDINFO lpici) PURE;
  386. STDMETHOD(GetCommandString)(THIS_
  387. UINT idCmd,
  388. UINT uType,
  389. UINT * pwReserved,
  390. LPSTR pszName,
  391. UINT cchMax) PURE;
  392. // *** IContextMenu2 methods ***
  393. STDMETHOD(HandleMenuMsg)(THIS_
  394. UINT uMsg,
  395. WPARAM wParam,
  396. LPARAM lParam) PURE;
  397. };
  398. typedef IContextMenu2 * LPCONTEXTMENU2;
  399. //
  400. // IContextMenu3 (IContextMenu with one new member)
  401. //
  402. // IContextMenu3::HandleMenuMsg2
  403. //
  404. // This function is called, if the client of IContextMenu is aware of
  405. // IContextMenu3 interface and receives a menu message while
  406. // it is calling TrackPopupMenu (in the window proc of hwndOwner):
  407. //
  408. #undef INTERFACE
  409. #define INTERFACE IContextMenu3
  410. DECLARE_INTERFACE_(IContextMenu3, IContextMenu2)
  411. {
  412. // *** IUnknown methods ***
  413. STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  414. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  415. STDMETHOD_(ULONG,Release) (THIS) PURE;
  416. // *** IContextMenu methods ***
  417. STDMETHOD(QueryContextMenu)(THIS_
  418. HMENU hmenu,
  419. UINT indexMenu,
  420. UINT idCmdFirst,
  421. UINT idCmdLast,
  422. UINT uFlags) PURE;
  423. STDMETHOD(InvokeCommand)(THIS_
  424. LPCMINVOKECOMMANDINFO lpici) PURE;
  425. STDMETHOD(GetCommandString)(THIS_
  426. UINT idCmd,
  427. UINT uType,
  428. UINT * pwReserved,
  429. LPSTR pszName,
  430. UINT cchMax) PURE;
  431. // *** IContextMenu2 methods ***
  432. STDMETHOD(HandleMenuMsg)(THIS_
  433. UINT uMsg,
  434. WPARAM wParam,
  435. LPARAM lParam) PURE;
  436. // *** IContextMenu3 methods ***
  437. STDMETHOD(HandleMenuMsg2)(THIS_
  438. UINT uMsg,
  439. WPARAM wParam,
  440. LPARAM lParam,
  441. LRESULT* plResult) PURE;
  442. };
  443. typedef IContextMenu3 * LPCONTEXTMENU3;
  444. //===========================================================================
  445. //
  446. // Interface: IShellExtInit
  447. //
  448. // The IShellExtInit interface is used by the explorer to initialize shell
  449. // extension objects. The explorer (1) calls CoCreateInstance (or equivalent)
  450. // with the registered CLSID and IID_IShellExtInit, (2) calls its Initialize
  451. // member, then (3) calls its QueryInterface to a particular interface (such
  452. // as IContextMenu or IPropSheetExt and (4) performs the rest of operation.
  453. //
  454. //
  455. // [Member functions]
  456. //
  457. // IShellExtInit::Initialize
  458. //
  459. // This member function is called when the explorer is initializing either
  460. // context menu extension, property sheet extension or non-default drag-drop
  461. // extension.
  462. //
  463. // Parameters: (context menu or property sheet extension)
  464. // pidlFolder -- Specifies the parent folder
  465. // lpdobj -- Spefifies the set of items selected in that folder.
  466. // hkeyProgID -- Specifies the type of the focused item in the selection.
  467. //
  468. // Parameters: (non-default drag-and-drop extension)
  469. // pidlFolder -- Specifies the target (destination) folder
  470. // lpdobj -- Specifies the items that are dropped (see the description
  471. // about shell's clipboard below for clipboard formats).
  472. // hkeyProgID -- Specifies the folder type.
  473. //
  474. //===========================================================================
  475. #undef INTERFACE
  476. #define INTERFACE IShellExtInit
  477. DECLARE_INTERFACE_(IShellExtInit, IUnknown)
  478. {
  479. // *** IUnknown methods ***
  480. STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  481. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  482. STDMETHOD_(ULONG,Release) (THIS) PURE;
  483. // *** IShellExtInit methods ***
  484. STDMETHOD(Initialize)(THIS_ LPCITEMIDLIST pidlFolder,
  485. LPDATAOBJECT lpdobj, HKEY hkeyProgID) PURE;
  486. };
  487. typedef IShellExtInit * LPSHELLEXTINIT;
  488. //===========================================================================
  489. //
  490. // Interface: IShellPropSheetExt
  491. //
  492. // The explorer uses the IShellPropSheetExt to allow property sheet
  493. // extensions or control panel extensions to add additional property
  494. // sheet pages.
  495. //
  496. //
  497. // [Member functions]
  498. //
  499. // IShellPropSheetExt::AddPages
  500. //
  501. // The explorer calls this member function when it finds a registered
  502. // property sheet extension for a particular type of object. For each
  503. // additional page, the extension creates a page object by calling
  504. // CreatePropertySheetPage API and calls lpfnAddPage.
  505. //
  506. // Parameters:
  507. // lpfnAddPage -- Specifies the callback function.
  508. // lParam -- Specifies the opaque handle to be passed to the callback function.
  509. //
  510. //
  511. // IShellPropSheetExt::ReplacePage
  512. //
  513. // The explorer never calls this member of property sheet extensions. The
  514. // explorer calls this member of control panel extensions, so that they
  515. // can replace some of default control panel pages (such as a page of
  516. // mouse control panel).
  517. //
  518. // Parameters:
  519. // uPageID -- Specifies the page to be replaced.
  520. // lpfnReplace Specifies the callback function.
  521. // lParam -- Specifies the opaque handle to be passed to the callback function.
  522. //
  523. //===========================================================================
  524. #undef INTERFACE
  525. #define INTERFACE IShellPropSheetExt
  526. DECLARE_INTERFACE_(IShellPropSheetExt, IUnknown)
  527. {
  528. // *** IUnknown methods ***
  529. STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  530. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  531. STDMETHOD_(ULONG,Release) (THIS) PURE;
  532. // *** IShellPropSheetExt methods ***
  533. STDMETHOD(AddPages)(THIS_ LPFNADDPROPSHEETPAGE lpfnAddPage, LPARAM lParam) PURE;
  534. STDMETHOD(ReplacePage)(THIS_ UINT uPageID, LPFNADDPROPSHEETPAGE lpfnReplaceWith, LPARAM lParam) PURE;
  535. };
  536. typedef IShellPropSheetExt * LPSHELLPROPSHEETEXT;
  537. //===========================================================================
  538. //
  539. // IPersistFolder Interface
  540. //
  541. // The IPersistFolder interface is used by the file system implementation of
  542. // IShellFolder::BindToObject when it is initializing a shell folder object.
  543. //
  544. //
  545. // [Member functions]
  546. //
  547. // IPersistFolder::Initialize
  548. //
  549. // This member function is called when the explorer is initializing a
  550. // shell folder object.
  551. //
  552. // Parameters:
  553. // pidl -- Specifies the absolute location of the folder.
  554. //
  555. //===========================================================================
  556. #undef INTERFACE
  557. #define INTERFACE IPersistFolder
  558. DECLARE_INTERFACE_(IPersistFolder, IPersist) // fld
  559. {
  560. // *** IUnknown methods ***
  561. STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  562. STDMETHOD_(ULONG,AddRef)(THIS) PURE;
  563. STDMETHOD_(ULONG,Release)(THIS) PURE;
  564. // *** IPersist methods ***
  565. STDMETHOD(GetClassID)(THIS_ LPCLSID lpClassID) PURE;
  566. // *** IPersistFolder methods ***
  567. STDMETHOD(Initialize)(THIS_ LPCITEMIDLIST pidl) PURE;
  568. };
  569. typedef IPersistFolder *LPPERSISTFOLDER;
  570. #undef INTERFACE
  571. #define INTERFACE IPersistFolder2
  572. DECLARE_INTERFACE_(IPersistFolder2, IPersistFolder)
  573. {
  574. // *** IUnknown methods ***
  575. STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  576. STDMETHOD_(ULONG,AddRef)(THIS) PURE;
  577. STDMETHOD_(ULONG,Release)(THIS) PURE;
  578. // *** IPersist methods ***
  579. STDMETHOD(GetClassID)(THIS_ LPCLSID lpClassID) PURE;
  580. // *** IPersistFolder methods ***
  581. STDMETHOD(Initialize)(THIS_ LPCITEMIDLIST pidl) PURE;
  582. // *** IPersistFolder2 methods ***
  583. STDMETHOD(GetCurFolder)(THIS_ LPITEMIDLIST *ppidl) PURE;
  584. };
  585. //===========================================================================
  586. //
  587. // IExtractIcon interface
  588. //
  589. // This interface is used in two different places in the shell.
  590. //
  591. // Case-1: Icons of sub-folders for the scope-pane of the explorer.
  592. //
  593. // It is used by the explorer to get the "icon location" of
  594. // sub-folders from each shell folders. When the user expands a folder
  595. // in the scope pane of the explorer, the explorer does following:
  596. // (1) binds to the folder (gets IShellFolder),
  597. // (2) enumerates its sub-folders by calling its EnumObjects member,
  598. // (3) calls its GetUIObjectOf member to get IExtractIcon interface
  599. // for each sub-folders.
  600. // In this case, the explorer uses only IExtractIcon::GetIconLocation
  601. // member to get the location of the appropriate icon. An icon location
  602. // always consists of a file name (typically DLL or EXE) and either an icon
  603. // resource or an icon index.
  604. //
  605. //
  606. // Case-2: Extracting an icon image from a file
  607. //
  608. // It is used by the shell when it extracts an icon image
  609. // from a file. When the shell is extracting an icon from a file,
  610. // it does following:
  611. // (1) creates the icon extraction handler object (by getting its CLSID
  612. // under the {ProgID}\shell\ExtractIconHanler key and calling
  613. // CoCreateInstance requesting for IExtractIcon interface).
  614. // (2) Calls IExtractIcon::GetIconLocation.
  615. // (3) Then, calls IExtractIcon::ExtractIcon with the location/index pair.
  616. // (4) If (3) returns NOERROR, it uses the returned icon.
  617. // (5) Otherwise, it recursively calls this logic with new location
  618. // assuming that the location string contains a fully qualified path name.
  619. //
  620. // From extension programmer's point of view, there are only two cases
  621. // where they provide implementations of IExtractIcon:
  622. // Case-1) providing explorer extensions (i.e., IShellFolder).
  623. // Case-2) providing per-instance icons for some types of files.
  624. //
  625. // Because Case-1 is described above, we'll explain only Case-2 here.
  626. //
  627. // When the shell is about display an icon for a file, it does following:
  628. // (1) Finds its ProgID and ClassID.
  629. // (2) If the file has a ClassID, it gets the icon location string from the
  630. // "DefaultIcon" key under it. The string indicates either per-class
  631. // icon (e.g., "FOOBAR.DLL,2") or per-instance icon (e.g., "%1,1").
  632. // (3) If a per-instance icon is specified, the shell creates an icon
  633. // extraction handler object for it, and extracts the icon from it
  634. // (which is described above).
  635. //
  636. // It is important to note that the shell calls IExtractIcon::GetIconLocation
  637. // first, then calls IExtractIcon::Extract. Most application programs
  638. // that support per-instance icons will probably store an icon location
  639. // (DLL/EXE name and index/id) rather than an icon image in each file.
  640. // In those cases, a programmer needs to implement only the GetIconLocation
  641. // member and it Extract member simply returns S_FALSE. They need to
  642. // implement Extract member only if they decided to store the icon images
  643. // within files themselved or some other database (which is very rare).
  644. //
  645. //
  646. //
  647. // [Member functions]
  648. //
  649. //
  650. // IExtractIcon::GetIconLocation
  651. //
  652. // This function returns an icon location.
  653. //
  654. // Parameters:
  655. // uFlags [in] -- Specifies if it is opened or not (GIL_OPENICON or 0)
  656. // szIconFile [out] -- Specifies the string buffer buffer for a location name.
  657. // cchMax [in] -- Specifies the size of szIconFile (almost always MAX_PATH)
  658. // piIndex [out] -- Sepcifies the address of UINT for the index.
  659. // pwFlags [out] -- Returns GIL_* flags
  660. // Returns:
  661. // NOERROR, if it returns a valid location; S_FALSE, if the shell use a
  662. // default icon.
  663. //
  664. // Notes: The location may or may not be a path to a file. The caller can
  665. // not assume anything unless the subsequent Extract member call returns
  666. // S_FALSE.
  667. //
  668. // if the returned location is not a path to a file, GIL_NOTFILENAME should
  669. // be set in the returned flags.
  670. //
  671. // IExtractIcon::Extract
  672. //
  673. // This function extracts an icon image from a specified file.
  674. //
  675. // Parameters:
  676. // pszFile [in] -- Specifies the icon location (typically a path to a file).
  677. // nIconIndex [in] -- Specifies the icon index.
  678. // phiconLarge [out] -- Specifies the HICON variable for large icon.
  679. // phiconSmall [out] -- Specifies the HICON variable for small icon.
  680. // nIconSize [in] -- Specifies the size icon required (size of large icon)
  681. // LOWORD is the requested large icon size
  682. // HIWORD is the requested small icon size
  683. // Returns:
  684. // NOERROR, if it extracted the from the file.
  685. // S_FALSE, if the caller should extract from the file specified in the
  686. // location.
  687. //
  688. //===========================================================================
  689. // GetIconLocation() input flags
  690. #define GIL_OPENICON 0x0001 // allows containers to specify an "open" look
  691. #define GIL_FORSHELL 0x0002 // icon is to be displayed in a ShellFolder
  692. #define GIL_ASYNC 0x0020 // this is an async extract, return E_ASYNC
  693. // GetIconLocation() return flags
  694. #define GIL_SIMULATEDOC 0x0001 // simulate this document icon for this
  695. #define GIL_PERINSTANCE 0x0002 // icons from this class are per instance (each file has its own)
  696. #define GIL_PERCLASS 0x0004 // icons from this class per class (shared for all files of this type)
  697. #define GIL_NOTFILENAME 0x0008 // location is not a filename, must call ::ExtractIcon
  698. #define GIL_DONTCACHE 0x0010 // this icon should not be cached
  699. #undef INTERFACE
  700. #define INTERFACE IExtractIconA
  701. DECLARE_INTERFACE_(IExtractIconA, IUnknown) // exic
  702. {
  703. // *** IUnknown methods ***
  704. STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  705. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  706. STDMETHOD_(ULONG,Release) (THIS) PURE;
  707. // *** IExtractIcon methods ***
  708. STDMETHOD(GetIconLocation)(THIS_
  709. UINT uFlags,
  710. LPSTR szIconFile,
  711. UINT cchMax,
  712. int * piIndex,
  713. UINT * pwFlags) PURE;
  714. STDMETHOD(Extract)(THIS_
  715. LPCSTR pszFile,
  716. UINT nIconIndex,
  717. HICON *phiconLarge,
  718. HICON *phiconSmall,
  719. UINT nIconSize) PURE;
  720. };
  721. typedef IExtractIconA * LPEXTRACTICONA;
  722. #undef INTERFACE
  723. #define INTERFACE IExtractIconW
  724. DECLARE_INTERFACE_(IExtractIconW, IUnknown) // exic
  725. {
  726. // *** IUnknown methods ***
  727. STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  728. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  729. STDMETHOD_(ULONG,Release) (THIS) PURE;
  730. // *** IExtractIcon methods ***
  731. STDMETHOD(GetIconLocation)(THIS_
  732. UINT uFlags,
  733. LPWSTR szIconFile,
  734. UINT cchMax,
  735. int * piIndex,
  736. UINT * pwFlags) PURE;
  737. STDMETHOD(Extract)(THIS_
  738. LPCWSTR pszFile,
  739. UINT nIconIndex,
  740. HICON *phiconLarge,
  741. HICON *phiconSmall,
  742. UINT nIconSize) PURE;
  743. };
  744. typedef IExtractIconW * LPEXTRACTICONW;
  745. #ifdef UNICODE
  746. #define IExtractIcon IExtractIconW
  747. #define IExtractIconVtbl IExtractIconWVtbl
  748. #define LPEXTRACTICON LPEXTRACTICONW
  749. #else
  750. #define IExtractIcon IExtractIconA
  751. #define IExtractIconVtbl IExtractIconAVtbl
  752. #define LPEXTRACTICON LPEXTRACTICONA
  753. #endif
  754. //===========================================================================
  755. //
  756. // IShellIcon Interface
  757. //
  758. // used to get a icon index for a IShellFolder object.
  759. //
  760. // this interface can be implemented by a IShellFolder, as a quick way to
  761. // return the icon for a object in the folder.
  762. //
  763. // a instance of this interface is only created once for the folder, unlike
  764. // IExtractIcon witch is created once for each object.
  765. //
  766. // if a ShellFolder does not implement this interface, the standard
  767. // GetUIObject(....IExtractIcon) method will be used to get a icon
  768. // for all objects.
  769. //
  770. // the following standard imagelist indexs can be returned:
  771. //
  772. // 0 document (blank page) (not associated)
  773. // 1 document (with stuff on the page)
  774. // 2 application (exe, com, bat)
  775. // 3 folder (plain)
  776. // 4 folder (open)
  777. //
  778. // IShellIcon:GetIconOf(pidl, flags, lpIconIndex)
  779. //
  780. // pidl object to get icon for.
  781. // flags GIL_* input flags (GIL_OPEN, ...)
  782. // lpIconIndex place to return icon index.
  783. //
  784. // returns:
  785. // NOERROR, if lpIconIndex contains the correct system imagelist index.
  786. // S_FALSE, if unable to get icon for this object, go through
  787. // GetUIObject, IExtractIcon, methods.
  788. //
  789. //===========================================================================
  790. #undef INTERFACE
  791. #define INTERFACE IShellIcon
  792. DECLARE_INTERFACE_(IShellIcon, IUnknown) // shi
  793. {
  794. // *** IUnknown methods ***
  795. STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  796. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  797. STDMETHOD_(ULONG,Release) (THIS) PURE;
  798. // *** IShellIcon methods ***
  799. STDMETHOD(GetIconOf)(THIS_ LPCITEMIDLIST pidl, UINT flags,
  800. LPINT lpIconIndex) PURE;
  801. };
  802. typedef IShellIcon *LPSHELLICON;
  803. //===========================================================================
  804. //
  805. // IShellIconOverlayIdentifier
  806. //
  807. // Used to identify a file as a member of the group of files that have this specific
  808. // icon overlay
  809. //
  810. // Users can create new IconOverlayIdentifiers and place them in the following registry
  811. // location together with the Icon overlay image and their priority.
  812. // HKEY_LOCAL_MACHINE "Software\\Microsoft\\Windows\\CurrentVersion\\ShellIconOverlayIdentifiers"
  813. //
  814. // The shell will enumerate through all IconOverlayIdentifiers at start, and prioritize
  815. // them according to internal rules, in case the internal rules don't apply, we use their
  816. // input priority
  817. //
  818. // IShellIconOverlayIdentifier:IsMemberOf(LPCWSTR pwszPath, DWORD dwAttrib)
  819. // pwszPath full path of the file
  820. // dwAttrib attribute of this file
  821. //
  822. // returns:
  823. // S_OK, if the file is a member
  824. // S_FALSE, if the file is not a member
  825. // E_FAIL, if the operation failed due to bad WIN32_FIND_DATA
  826. //
  827. // IShellIconOverlayIdentifier::GetOverlayInfo(LPWSTR pwszIconFile, int * pIndex, DWORD * dwFlags) PURE;
  828. // pszIconFile the path of the icon file
  829. // pIndex Depend on the flags, this could contain the IconIndex or the Sytem Imagelist Index
  830. // dwFlags defined below
  831. //
  832. // IShellIconOverlayIdentifier::GetPriority(int * pIPriority) PURE;
  833. // pIPriority the priority of this Overlay Identifier
  834. //
  835. //===========================================================================
  836. #undef INTERFACE
  837. #define INTERFACE IShellIconOverlayIdentifier
  838. DECLARE_INTERFACE_(IShellIconOverlayIdentifier, IUnknown)
  839. {
  840. // *** IUnknown methods ***
  841. STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  842. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  843. STDMETHOD_(ULONG,Release) (THIS) PURE;
  844. // *** IShellIconOverlayIdentifier methods ***
  845. STDMETHOD (IsMemberOf)(THIS_ LPCWSTR pwszPath, DWORD dwAttrib) PURE;
  846. STDMETHOD (GetOverlayInfo)(THIS_ LPWSTR pwszIconFile, int cchMax, int * pIndex, DWORD * pdwFlags) PURE;
  847. STDMETHOD (GetPriority)(THIS_ int * pIPriority) PURE;
  848. };
  849. #define ISIOI_ICONFILE 0x00000001 // path is returned through pwszIconFile
  850. #define ISIOI_ICONINDEX 0x00000002 // icon index in pwszIconFile is returned through pIndex
  851. #define ISIOI_SYSIMAGELISTINDEX 0x00000004 // system imagelist icon index is returned through pIndex
  852. //===========================================================================
  853. //
  854. // IShellIconOverlay
  855. //
  856. // Used to return the icon overlay index or its icon index for an IShellFolder object,
  857. // this is always implemented with IShellFolder
  858. //
  859. // IShellIconOverlay:GetOverlayIndex(LPCITEMIDLIST pidl, DWORD * pdwIndex)
  860. // pidl object to identify icon overlay for.
  861. // pdwIndex the Overlay Index in the system image list
  862. //
  863. // IShellIconOverlay:GetOverlayIconIndex(LPCITEMIDLIST pidl, DWORD * pdwIndex)
  864. // pdwIconIndex the Overlay Icon index in the system image list
  865. // This method is only used for those who are interested in seeing the real bits
  866. // of the Overlay Icon
  867. //
  868. // returns:
  869. // S_OK, if the index of an Overlay is found
  870. // S_FALSE, if no Overlay exists for this file
  871. // E_FAIL, if pidl is bad
  872. //
  873. //===========================================================================
  874. #undef INTERFACE
  875. #define INTERFACE IShellIconOverlay
  876. DECLARE_INTERFACE_(IShellIconOverlay, IUnknown)
  877. {
  878. // *** IUnknown methods ***
  879. STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  880. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  881. STDMETHOD_(ULONG,Release) (THIS) PURE;
  882. // *** IShellIconOverlay methods ***
  883. STDMETHOD(GetOverlayIndex)(THIS_ LPCITEMIDLIST pidl, int * pIndex) PURE;
  884. STDMETHOD(GetOverlayIconIndex)(THIS_ LPCITEMIDLIST pidl, int * pIconIndex) PURE;
  885. };
  886. //===========================================================================
  887. //
  888. // IShellLink Interface
  889. //
  890. //===========================================================================
  891. #ifdef UNICODE
  892. #define IShellLink IShellLinkW
  893. #define IShellLinkVtbl IShellLinkWVtbl
  894. #else
  895. #define IShellLink IShellLinkA
  896. #define IShellLinkVtbl IShellLinkAVtbl
  897. #endif
  898. // IShellLink::Resolve fFlags
  899. typedef enum {
  900. SLR_NO_UI = 0x0001,
  901. SLR_ANY_MATCH = 0x0002,
  902. SLR_UPDATE = 0x0004,
  903. SLR_NOUPDATE = 0x0008,
  904. } SLR_FLAGS;
  905. // IShellLink::GetPath fFlags
  906. typedef enum {
  907. SLGP_SHORTPATH = 0x0001,
  908. SLGP_UNCPRIORITY = 0x0002,
  909. SLGP_RAWPATH = 0x0004,
  910. } SLGP_FLAGS;
  911. #undef INTERFACE
  912. #define INTERFACE IShellLinkA
  913. DECLARE_INTERFACE_(IShellLinkA, IUnknown) // sl
  914. {
  915. // *** IUnknown methods ***
  916. STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  917. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  918. STDMETHOD_(ULONG,Release) (THIS) PURE;
  919. // *** IShellLink methods ***
  920. STDMETHOD(GetPath)(THIS_ LPSTR pszFile, int cchMaxPath, WIN32_FIND_DATAA *pfd, DWORD fFlags) PURE;
  921. STDMETHOD(GetIDList)(THIS_ LPITEMIDLIST * ppidl) PURE;
  922. STDMETHOD(SetIDList)(THIS_ LPCITEMIDLIST pidl) PURE;
  923. STDMETHOD(GetDescription)(THIS_ LPSTR pszName, int cchMaxName) PURE;
  924. STDMETHOD(SetDescription)(THIS_ LPCSTR pszName) PURE;
  925. STDMETHOD(GetWorkingDirectory)(THIS_ LPSTR pszDir, int cchMaxPath) PURE;
  926. STDMETHOD(SetWorkingDirectory)(THIS_ LPCSTR pszDir) PURE;
  927. STDMETHOD(GetArguments)(THIS_ LPSTR pszArgs, int cchMaxPath) PURE;
  928. STDMETHOD(SetArguments)(THIS_ LPCSTR pszArgs) PURE;
  929. STDMETHOD(GetHotkey)(THIS_ WORD *pwHotkey) PURE;
  930. STDMETHOD(SetHotkey)(THIS_ WORD wHotkey) PURE;
  931. STDMETHOD(GetShowCmd)(THIS_ int *piShowCmd) PURE;
  932. STDMETHOD(SetShowCmd)(THIS_ int iShowCmd) PURE;
  933. STDMETHOD(GetIconLocation)(THIS_ LPSTR pszIconPath, int cchIconPath, int *piIcon) PURE;
  934. STDMETHOD(SetIconLocation)(THIS_ LPCSTR pszIconPath, int iIcon) PURE;
  935. STDMETHOD(SetRelativePath)(THIS_ LPCSTR pszPathRel, DWORD dwReserved) PURE;
  936. STDMETHOD(Resolve)(THIS_ HWND hwnd, DWORD fFlags) PURE;
  937. STDMETHOD(SetPath)(THIS_ LPCSTR pszFile) PURE;
  938. };
  939. #undef INTERFACE
  940. #define INTERFACE IShellLinkW
  941. DECLARE_INTERFACE_(IShellLinkW, IUnknown) // sl
  942. {
  943. // *** IUnknown methods ***
  944. STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  945. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  946. STDMETHOD_(ULONG,Release) (THIS) PURE;
  947. // *** IShellLink methods ***
  948. STDMETHOD(GetPath)(THIS_ LPWSTR pszFile, int cchMaxPath, WIN32_FIND_DATAW *pfd, DWORD fFlags) PURE;
  949. STDMETHOD(GetIDList)(THIS_ LPITEMIDLIST * ppidl) PURE;
  950. STDMETHOD(SetIDList)(THIS_ LPCITEMIDLIST pidl) PURE;
  951. STDMETHOD(GetDescription)(THIS_ LPWSTR pszName, int cchMaxName) PURE;
  952. STDMETHOD(SetDescription)(THIS_ LPCWSTR pszName) PURE;
  953. STDMETHOD(GetWorkingDirectory)(THIS_ LPWSTR pszDir, int cchMaxPath) PURE;
  954. STDMETHOD(SetWorkingDirectory)(THIS_ LPCWSTR pszDir) PURE;
  955. STDMETHOD(GetArguments)(THIS_ LPWSTR pszArgs, int cchMaxPath) PURE;
  956. STDMETHOD(SetArguments)(THIS_ LPCWSTR pszArgs) PURE;
  957. STDMETHOD(GetHotkey)(THIS_ WORD *pwHotkey) PURE;
  958. STDMETHOD(SetHotkey)(THIS_ WORD wHotkey) PURE;
  959. STDMETHOD(GetShowCmd)(THIS_ int *piShowCmd) PURE;
  960. STDMETHOD(SetShowCmd)(THIS_ int iShowCmd) PURE;
  961. STDMETHOD(GetIconLocation)(THIS_ LPWSTR pszIconPath, int cchIconPath, int *piIcon) PURE;
  962. STDMETHOD(SetIconLocation)(THIS_ LPCWSTR pszIconPath, int iIcon) PURE;
  963. STDMETHOD(SetRelativePath)(THIS_ LPCWSTR pszPathRel, DWORD dwReserved) PURE;
  964. STDMETHOD(Resolve)(THIS_ HWND hwnd, DWORD fFlags) PURE;
  965. STDMETHOD(SetPath)(THIS_ LPCWSTR pszFile) PURE;
  966. };
  967. #ifdef _INC_SHELLAPI /* for LPSHELLEXECUTEINFO */
  968. //===========================================================================
  969. //
  970. // IShellExecuteHook Interface
  971. //
  972. //===========================================================================
  973. #undef INTERFACE
  974. #define INTERFACE IShellExecuteHookA
  975. DECLARE_INTERFACE_(IShellExecuteHookA, IUnknown) // shexhk
  976. {
  977. // *** IUnknown methods ***
  978. STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  979. STDMETHOD_(ULONG, AddRef) (THIS) PURE;
  980. STDMETHOD_(ULONG, Release) (THIS) PURE;
  981. // *** IShellExecuteHookA methods ***
  982. STDMETHOD(Execute)(THIS_ LPSHELLEXECUTEINFOA pei) PURE;
  983. };
  984. #undef INTERFACE
  985. #define INTERFACE IShellExecuteHookW
  986. DECLARE_INTERFACE_(IShellExecuteHookW, IUnknown) // shexhk
  987. {
  988. // *** IUnknown methods ***
  989. STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  990. STDMETHOD_(ULONG, AddRef) (THIS) PURE;
  991. STDMETHOD_(ULONG, Release) (THIS) PURE;
  992. // *** IShellExecuteHookW methods ***
  993. STDMETHOD(Execute)(THIS_ LPSHELLEXECUTEINFOW pei) PURE;
  994. };
  995. #ifdef UNICODE
  996. #define IShellExecuteHook IShellExecuteHookW
  997. #define IShellExecuteHookVtbl IShellExecuteHookWVtbl
  998. #else
  999. #define IShellExecuteHook IShellExecuteHookA
  1000. #define IShellExecuteHookVtbl IShellExecuteHookAVtbl
  1001. #endif
  1002. #endif
  1003. //===========================================================================
  1004. //
  1005. // IURLSearchHook Interface
  1006. //
  1007. //===========================================================================
  1008. #undef INTERFACE
  1009. #define INTERFACE IURLSearchHook
  1010. DECLARE_INTERFACE_(IURLSearchHook, IUnknown)
  1011. {
  1012. // *** IUnknown methods ***
  1013. STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  1014. STDMETHOD_(ULONG, AddRef) (THIS) PURE;
  1015. STDMETHOD_(ULONG, Release) (THIS) PURE;
  1016. // *** IURLSearchHook methods ***
  1017. STDMETHOD(Translate)(THIS_ LPWSTR lpwszSearchURL, DWORD cchBufferSize) PURE;
  1018. };
  1019. //===========================================================================
  1020. //
  1021. // INewShortcutHook Interface
  1022. //
  1023. //===========================================================================
  1024. #undef INTERFACE
  1025. #define INTERFACE INewShortcutHookA
  1026. DECLARE_INTERFACE_(INewShortcutHookA, IUnknown) // nshhk
  1027. {
  1028. // *** IUnknown methods ***
  1029. STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  1030. STDMETHOD_(ULONG, AddRef) (THIS) PURE;
  1031. STDMETHOD_(ULONG, Release) (THIS) PURE;
  1032. // *** INewShortcutHook methods ***
  1033. STDMETHOD(SetReferent)(THIS_ LPCSTR pcszReferent, HWND hwnd) PURE;
  1034. STDMETHOD(GetReferent)(THIS_ LPSTR pszReferent, int cchReferent) PURE;
  1035. STDMETHOD(SetFolder)(THIS_ LPCSTR pcszFolder) PURE;
  1036. STDMETHOD(GetFolder)(THIS_ LPSTR pszFolder, int cchFolder) PURE;
  1037. STDMETHOD(GetName)(THIS_ LPSTR pszName, int cchName) PURE;
  1038. STDMETHOD(GetExtension)(THIS_ LPSTR pszExtension, int cchExtension) PURE;
  1039. };
  1040. #undef INTERFACE
  1041. #define INTERFACE INewShortcutHookW
  1042. DECLARE_INTERFACE_(INewShortcutHookW, IUnknown) // nshhk
  1043. {
  1044. // *** IUnknown methods ***
  1045. STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  1046. STDMETHOD_(ULONG, AddRef) (THIS) PURE;
  1047. STDMETHOD_(ULONG, Release) (THIS) PURE;
  1048. // *** INewShortcutHook methods ***
  1049. STDMETHOD(SetReferent)(THIS_ LPCWSTR pcszReferent, HWND hwnd) PURE;
  1050. STDMETHOD(GetReferent)(THIS_ LPWSTR pszReferent, int cchReferent) PURE;
  1051. STDMETHOD(SetFolder)(THIS_ LPCWSTR pcszFolder) PURE;
  1052. STDMETHOD(GetFolder)(THIS_ LPWSTR pszFolder, int cchFolder) PURE;
  1053. STDMETHOD(GetName)(THIS_ LPWSTR pszName, int cchName) PURE;
  1054. STDMETHOD(GetExtension)(THIS_ LPWSTR pszExtension, int cchExtension) PURE;
  1055. };
  1056. #ifdef UNICODE
  1057. #define INewShortcutHook INewShortcutHookW
  1058. #define INewShortcutHookVtbl INewShortcutHookWVtbl
  1059. #else
  1060. #define INewShortcutHook INewShortcutHookA
  1061. #define INewShortcutHookVtbl INewShortcutHookAVtbl
  1062. #endif
  1063. //===========================================================================
  1064. //
  1065. // ICopyHook Interface
  1066. //
  1067. // The copy hook is called whenever file system directories are
  1068. // copy/moved/deleted/renamed via the shell. It is also called by the shell
  1069. // on changes of status of printers.
  1070. //
  1071. // Clients register their id under STRREG_SHEX_COPYHOOK for file system hooks
  1072. // and STRREG_SHEx_PRNCOPYHOOK for printer hooks.
  1073. // the CopyCallback is called prior to the action, so the hook has the chance
  1074. // to allow, deny or cancel the operation by returning the falues:
  1075. // IDYES - means allow the operation
  1076. // IDNO - means disallow the operation on this file, but continue with
  1077. // any other operations (eg. batch copy)
  1078. // IDCANCEL - means disallow the current operation and cancel any pending
  1079. // operations
  1080. //
  1081. // arguments to the CopyCallback
  1082. // hwnd - window to use for any UI
  1083. // wFunc - what operation is being done
  1084. // wFlags - and flags (FOF_*) set in the initial call to the file operation
  1085. // pszSrcFile - name of the source file
  1086. // dwSrcAttribs - file attributes of the source file
  1087. // pszDestFile - name of the destiation file (for move and renames)
  1088. // dwDestAttribs - file attributes of the destination file
  1089. //
  1090. //
  1091. //===========================================================================
  1092. #ifndef FO_MOVE //these need to be kept in sync with the ones in shellapi.h
  1093. // file operations
  1094. #define FO_MOVE 0x0001
  1095. #define FO_COPY 0x0002
  1096. #define FO_DELETE 0x0003
  1097. #define FO_RENAME 0x0004
  1098. #define FOF_MULTIDESTFILES 0x0001
  1099. #define FOF_CONFIRMMOUSE 0x0002
  1100. #define FOF_SILENT 0x0004 // don't create progress/report
  1101. #define FOF_RENAMEONCOLLISION 0x0008
  1102. #define FOF_NOCONFIRMATION 0x0010 // Don't prompt the user.
  1103. #define FOF_WANTMAPPINGHANDLE 0x0020 // Fill in SHFILEOPSTRUCT.hNameMappings
  1104. // Must be freed using SHFreeNameMappings
  1105. #define FOF_ALLOWUNDO 0x0040
  1106. #define FOF_FILESONLY 0x0080 // on *.*, do only files
  1107. #define FOF_SIMPLEPROGRESS 0x0100 // means don't show names of files
  1108. #define FOF_NOCONFIRMMKDIR 0x0200 // don't confirm making any needed dirs
  1109. #define FOF_NOERRORUI 0x0400 // don't put up error UI
  1110. #define FOF_NOCOPYSECURITYATTRIBS 0x0800 // dont copy NT file Security Attributes
  1111. typedef UINT FILEOP_FLAGS;
  1112. // printer operations
  1113. #define PO_DELETE 0x0013 // printer is being deleted
  1114. #define PO_RENAME 0x0014 // printer is being renamed
  1115. #define PO_PORTCHANGE 0x0020 // port this printer connected to is being changed
  1116. // if this id is set, the strings received by
  1117. // the copyhook are a doubly-null terminated
  1118. // list of strings. The first is the printer
  1119. // name and the second is the printer port.
  1120. #define PO_REN_PORT 0x0034 // PO_RENAME and PO_PORTCHANGE at same time.
  1121. // no POF_ flags currently defined
  1122. typedef UINT PRINTEROP_FLAGS;
  1123. #endif // FO_MOVE
  1124. #undef INTERFACE
  1125. #define INTERFACE ICopyHookA
  1126. DECLARE_INTERFACE_(ICopyHookA, IUnknown) // sl
  1127. {
  1128. // *** IUnknown methods ***
  1129. STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  1130. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  1131. STDMETHOD_(ULONG,Release) (THIS) PURE;
  1132. // *** ICopyHook methods ***
  1133. STDMETHOD_(UINT,CopyCallback) (THIS_ HWND hwnd, UINT wFunc, UINT wFlags, LPCSTR pszSrcFile, DWORD dwSrcAttribs,
  1134. LPCSTR pszDestFile, DWORD dwDestAttribs) PURE;
  1135. };
  1136. typedef ICopyHookA * LPCOPYHOOKA;
  1137. #undef INTERFACE
  1138. #define INTERFACE ICopyHookW
  1139. DECLARE_INTERFACE_(ICopyHookW, IUnknown) // sl
  1140. {
  1141. // *** IUnknown methods ***
  1142. STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  1143. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  1144. STDMETHOD_(ULONG,Release) (THIS) PURE;
  1145. // *** ICopyHook methods ***
  1146. STDMETHOD_(UINT,CopyCallback) (THIS_ HWND hwnd, UINT wFunc, UINT wFlags, LPCWSTR pszSrcFile, DWORD dwSrcAttribs,
  1147. LPCWSTR pszDestFile, DWORD dwDestAttribs) PURE;
  1148. };
  1149. typedef ICopyHookW * LPCOPYHOOKW;
  1150. #ifdef UNICODE
  1151. #define ICopyHook ICopyHookW
  1152. #define ICopyHookVtbl ICopyHookWVtbl
  1153. #define LPCOPYHOOK LPCOPYHOOKW
  1154. #else
  1155. #define ICopyHook ICopyHookA
  1156. #define ICopyHookVtbl ICopyHookAVtbl
  1157. #define LPCOPYHOOK LPCOPYHOOKA
  1158. #endif
  1159. //===========================================================================
  1160. //
  1161. // IFileViewerSite Interface
  1162. //
  1163. //===========================================================================
  1164. #undef INTERFACE
  1165. #define INTERFACE IFileViewerSite
  1166. DECLARE_INTERFACE_(IFileViewerSite, IUnknown)
  1167. {
  1168. // *** IUnknown methods ***
  1169. STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  1170. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  1171. STDMETHOD_(ULONG,Release) (THIS) PURE;
  1172. // *** IFileViewerSite methods ***
  1173. STDMETHOD(SetPinnedWindow) (THIS_ HWND hwnd) PURE;
  1174. STDMETHOD(GetPinnedWindow) (THIS_ HWND *phwnd) PURE;
  1175. };
  1176. typedef IFileViewerSite * LPFILEVIEWERSITE;
  1177. //===========================================================================
  1178. //
  1179. // IFileViewer Interface
  1180. //
  1181. // Implemented in a FileViewer component object. Used to tell a
  1182. // FileViewer to PrintTo or to view, the latter happening though
  1183. // ShowInitialize and Show. The filename is always given to the
  1184. // viewer through IPersistFile.
  1185. //
  1186. //===========================================================================
  1187. typedef struct
  1188. {
  1189. // Stuff passed into viewer (in)
  1190. DWORD cbSize; // Size of structure for future expansion...
  1191. HWND hwndOwner; // who is the owner window.
  1192. int iShow; // The show command
  1193. // Passed in and updated (in/Out)
  1194. DWORD dwFlags; // flags
  1195. RECT rect; // Where to create the window may have defaults
  1196. LPUNKNOWN punkRel; // Relese this interface when window is visible
  1197. // Stuff that might be returned from viewer (out)
  1198. OLECHAR strNewFile[MAX_PATH]; // New File to view.
  1199. } FVSHOWINFO, *LPFVSHOWINFO;
  1200. // Define File View Show Info Flags.
  1201. #define FVSIF_RECT 0x00000001 // The rect variable has valid data.
  1202. #define FVSIF_PINNED 0x00000002 // We should Initialize pinned
  1203. #define FVSIF_NEWFAILED 0x08000000 // The new file passed back failed
  1204. // to be viewed.
  1205. #define FVSIF_NEWFILE 0x80000000 // A new file to view has been returned
  1206. #define FVSIF_CANVIEWIT 0x40000000 // The viewer can view it.
  1207. #undef INTERFACE
  1208. #define INTERFACE IFileViewerA
  1209. DECLARE_INTERFACE(IFileViewerA)
  1210. {
  1211. // *** IUnknown methods ***
  1212. STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  1213. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  1214. STDMETHOD_(ULONG,Release) (THIS) PURE;
  1215. // *** IFileViewer methods ***
  1216. STDMETHOD(ShowInitialize) (THIS_ LPFILEVIEWERSITE lpfsi) PURE;
  1217. STDMETHOD(Show) (THIS_ LPFVSHOWINFO pvsi) PURE;
  1218. STDMETHOD(PrintTo) (THIS_ LPSTR pszDriver, BOOL fSuppressUI) PURE;
  1219. };
  1220. typedef IFileViewerA * LPFILEVIEWERA;
  1221. #undef INTERFACE
  1222. #define INTERFACE IFileViewerW
  1223. DECLARE_INTERFACE(IFileViewerW)
  1224. {
  1225. // *** IUnknown methods ***
  1226. STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  1227. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  1228. STDMETHOD_(ULONG,Release) (THIS) PURE;
  1229. // *** IFileViewer methods ***
  1230. STDMETHOD(ShowInitialize) (THIS_ LPFILEVIEWERSITE lpfsi) PURE;
  1231. STDMETHOD(Show) (THIS_ LPFVSHOWINFO pvsi) PURE;
  1232. STDMETHOD(PrintTo) (THIS_ LPWSTR pszDriver, BOOL fSuppressUI) PURE;
  1233. };
  1234. typedef IFileViewerW * LPFILEVIEWERW;
  1235. #ifdef UNICODE
  1236. #define IFileViewer IFileViewerW
  1237. #define LPFILEVIEWER LPFILEVIEWERW
  1238. #else
  1239. #define IFileViewer IFileViewerA
  1240. #define LPFILEVIEWER LPFILEVIEWERA
  1241. #endif
  1242. //==========================================================================
  1243. //
  1244. // IShellBrowser/IShellView/IShellFolder interface
  1245. //
  1246. // These three interfaces are used when the shell communicates with
  1247. // name space extensions. The shell (explorer) provides IShellBrowser
  1248. // interface, and extensions implements IShellFolder and IShellView
  1249. // interfaces.
  1250. //
  1251. //==========================================================================
  1252. //--------------------------------------------------------------------------
  1253. //
  1254. // Command/menuitem IDs
  1255. //
  1256. // The explorer dispatches WM_COMMAND messages based on the range of
  1257. // command/menuitem IDs. All the IDs of menuitems that the view (right
  1258. // pane) inserts must be in FCIDM_SHVIEWFIRST/LAST (otherwise, the explorer
  1259. // won't dispatch them). The view should not deal with any menuitems
  1260. // in FCIDM_BROWSERFIRST/LAST (otherwise, it won't work with the future
  1261. // version of the shell).
  1262. //
  1263. // FCIDM_SHVIEWFIRST/LAST for the right pane (IShellView)
  1264. // FCIDM_BROWSERFIRST/LAST for the explorer frame (IShellBrowser)
  1265. // FCIDM_GLOBAL/LAST for the explorer's submenu IDs
  1266. //
  1267. //--------------------------------------------------------------------------
  1268. #define FCIDM_SHVIEWFIRST 0x0000
  1269. #define FCIDM_SHVIEWLAST 0x7fff
  1270. #define FCIDM_BROWSERFIRST 0xa000
  1271. #define FCIDM_BROWSERLAST 0xbf00
  1272. #define FCIDM_GLOBALFIRST 0x8000
  1273. #define FCIDM_GLOBALLAST 0x9fff
  1274. //
  1275. // Global submenu IDs and separator IDs
  1276. //
  1277. #define FCIDM_MENU_FILE (FCIDM_GLOBALFIRST+0x0000)
  1278. #define FCIDM_MENU_EDIT (FCIDM_GLOBALFIRST+0x0040)
  1279. #define FCIDM_MENU_VIEW (FCIDM_GLOBALFIRST+0x0080)
  1280. #define FCIDM_MENU_VIEW_SEP_OPTIONS (FCIDM_GLOBALFIRST+0x0081)
  1281. #define FCIDM_MENU_TOOLS (FCIDM_GLOBALFIRST+0x00c0)
  1282. #define FCIDM_MENU_TOOLS_SEP_GOTO (FCIDM_GLOBALFIRST+0x00c1)
  1283. #define FCIDM_MENU_HELP (FCIDM_GLOBALFIRST+0x0100)
  1284. #define FCIDM_MENU_FIND (FCIDM_GLOBALFIRST+0x0140)
  1285. #define FCIDM_MENU_EXPLORE (FCIDM_GLOBALFIRST+0x0150)
  1286. #define FCIDM_MENU_FAVORITES (FCIDM_GLOBALFIRST+0x0170)
  1287. //--------------------------------------------------------------------------
  1288. // control IDs known to the view
  1289. //--------------------------------------------------------------------------
  1290. #define FCIDM_TOOLBAR (FCIDM_BROWSERFIRST + 0)
  1291. #define FCIDM_STATUS (FCIDM_BROWSERFIRST + 1)
  1292. #if (_WIN32_IE >= 0x0400)
  1293. //--------------------------------------------------------------------------
  1294. //
  1295. // The resource id of the offline cursor
  1296. // This cursor is avaialble in shdocvw.dll
  1297. #define IDC_OFFLINE_HAND 103
  1298. //
  1299. //--------------------------------------------------------------------------
  1300. #endif
  1301. //--------------------------------------------------------------------------
  1302. //
  1303. // FOLDERSETTINGS
  1304. //
  1305. // FOLDERSETTINGS is a data structure that explorer passes from one folder
  1306. // view to another, when the user is browsing. It calls ISV::GetCurrentInfo
  1307. // member to get the current settings and pass it to ISV::CreateViewWindow
  1308. // to allow the next folder view "inherit" it. These settings assumes a
  1309. // particular UI (which the shell's folder view has), and shell extensions
  1310. // may or may not use those settings.
  1311. //
  1312. //--------------------------------------------------------------------------
  1313. typedef LPBYTE LPVIEWSETTINGS;
  1314. // NB Bitfields.
  1315. // FWF_DESKTOP implies FWF_TRANSPARENT/NOCLIENTEDGE/NOSCROLL
  1316. typedef enum
  1317. {
  1318. FWF_AUTOARRANGE = 0x0001,
  1319. FWF_ABBREVIATEDNAMES = 0x0002,
  1320. FWF_SNAPTOGRID = 0x0004,
  1321. FWF_OWNERDATA = 0x0008,
  1322. FWF_BESTFITWINDOW = 0x0010,
  1323. FWF_DESKTOP = 0x0020,
  1324. FWF_SINGLESEL = 0x0040,
  1325. FWF_NOSUBFOLDERS = 0x0080,
  1326. FWF_TRANSPARENT = 0x0100,
  1327. FWF_NOCLIENTEDGE = 0x0200,
  1328. FWF_NOSCROLL = 0x0400,
  1329. FWF_ALIGNLEFT = 0x0800,
  1330. FWF_NOICONS = 0x1000,
  1331. FWF_SINGLECLICKACTIVATE=0x8000 // TEMPORARY -- NO UI FOR THIS
  1332. } FOLDERFLAGS;
  1333. typedef enum
  1334. {
  1335. FVM_ICON = 1,
  1336. FVM_SMALLICON = 2,
  1337. FVM_LIST = 3,
  1338. FVM_DETAILS = 4,
  1339. } FOLDERVIEWMODE;
  1340. typedef struct
  1341. {
  1342. UINT ViewMode; // View mode (FOLDERVIEWMODE values)
  1343. UINT fFlags; // View options (FOLDERFLAGS bits)
  1344. } FOLDERSETTINGS, *LPFOLDERSETTINGS;
  1345. typedef const FOLDERSETTINGS * LPCFOLDERSETTINGS;
  1346. //--------------------------------------------------------------------------
  1347. //
  1348. // Interface: IShellBrowser
  1349. //
  1350. // IShellBrowser interface is the interface that is provided by the shell
  1351. // explorer/folder frame window. When it creates the "contents pane" of
  1352. // a shell folder (which provides IShellFolder interface), it calls its
  1353. // CreateViewObject member function to create an IShellView object. Then,
  1354. // it calls its CreateViewWindow member to create the "contents pane"
  1355. // window. The pointer to the IShellBrowser interface is passed to
  1356. // the IShellView object as a parameter to this CreateViewWindow member
  1357. // function call.
  1358. //
  1359. // +--------------------------+ <-- Explorer window
  1360. // | [] Explorer |
  1361. // |--------------------------+ IShellBrowser
  1362. // | File Edit View .. |
  1363. // |--------------------------|
  1364. // | | |
  1365. // | | <-------- Content pane
  1366. // | | |
  1367. // | | | IShellView
  1368. // | | |
  1369. // | | |
  1370. // +--------------------------+
  1371. //
  1372. //
  1373. //
  1374. // [Member functions]
  1375. //
  1376. //
  1377. // IShellBrowser::GetWindow(phwnd)
  1378. //
  1379. // Inherited from IOleWindow::GetWindow.
  1380. //
  1381. //
  1382. // IShellBrowser::ContextSensitiveHelp(fEnterMode)
  1383. //
  1384. // Inherited from IOleWindow::ContextSensitiveHelp.
  1385. //
  1386. //
  1387. // IShellBrowser::InsertMenusSB(hmenuShared, lpMenuWidths)
  1388. //
  1389. // Similar to the IOleInPlaceFrame::InsertMenus. The explorer will put
  1390. // "File" and "Edit" pulldown in the File menu group, "View" and "Tools"
  1391. // in the Container menu group and "Help" in the Window menu group. Each
  1392. // pulldown menu will have a uniqu ID, FCIDM_MENU_FILE/EDIT/VIEW/TOOLS/HELP.
  1393. // The view is allowed to insert menuitems into those sub-menus by those
  1394. // IDs must be between FCIDM_SHVIEWFIRST and FCIDM_SHVIEWLAST.
  1395. //
  1396. //
  1397. // IShellBrowser::SetMenuSB(hmenuShared, holemenu, hwndActiveObject)
  1398. //
  1399. // Similar to the IOleInPlaceFrame::SetMenu. The explorer ignores the
  1400. // holemenu parameter (reserved for future enhancement) and performs
  1401. // menu-dispatch based on the menuitem IDs (see the description above).
  1402. // It is important to note that the explorer will add different
  1403. // set of menuitems depending on whether the view has a focus or not.
  1404. // Therefore, it is very important to call ISB::OnViewWindowActivate
  1405. // whenever the view window (or its children) gets the focus.
  1406. //
  1407. //
  1408. // IShellBrowser::RemoveMenusSB(hmenuShared)
  1409. //
  1410. // Same as the IOleInPlaceFrame::RemoveMenus.
  1411. //
  1412. //
  1413. // IShellBrowser::SetStatusTextSB(lpszStatusText)
  1414. //
  1415. // Same as the IOleInPlaceFrame::SetStatusText. It is also possible to
  1416. // send messages directly to the status window via SendControlMsg.
  1417. //
  1418. //
  1419. // IShellBrowser::EnableModelessSB(fEnable)
  1420. //
  1421. // Same as the IOleInPlaceFrame::EnableModeless.
  1422. //
  1423. //
  1424. // IShellBrowser::TranslateAcceleratorSB(lpmsg, wID)
  1425. //
  1426. // Same as the IOleInPlaceFrame::TranslateAccelerator, but will be
  1427. // never called because we don't support EXEs (i.e., the explorer has
  1428. // the message loop). This member function is defined here for possible
  1429. // future enhancement.
  1430. //
  1431. //
  1432. // IShellBrowser::BrowseObject(pidl, wFlags)
  1433. //
  1434. // The view calls this member to let shell explorer browse to another
  1435. // folder. The pidl and wFlags specifies the folder to be browsed.
  1436. //
  1437. // Following three flags specifies whether it creates another window or not.
  1438. // SBSP_SAMEBROWSER -- Browse to another folder with the same window.
  1439. // SBSP_NEWBROWSER -- Creates another window for the specified folder.
  1440. // SBSP_DEFBROWSER -- Default behavior (respects the view option).
  1441. //
  1442. // Following three flags specifies open, explore, or default mode. These .
  1443. // are ignored if SBSP_SAMEBROWSER or (SBSP_DEFBROWSER && (single window .
  1444. // browser || explorer)). .
  1445. // SBSP_OPENMODE -- Use a normal folder window
  1446. // SBSP_EXPLOREMODE -- Use an explorer window
  1447. // SBSP_DEFMODE -- Use the same as the current window
  1448. //
  1449. // Following three flags specifies the pidl.
  1450. // SBSP_ABSOLUTE -- pidl is an absolute pidl (relative from desktop)
  1451. // SBSP_RELATIVE -- pidl is relative from the current folder.
  1452. // SBSP_PARENT -- Browse the parent folder (ignores the pidl)
  1453. // SBSP_NAVIGATEBACK -- Navigate back (ignores the pidl)
  1454. // SBSP_NAVIGATEFORWARD -- Navigate forward (ignores the pidl)
  1455. //
  1456. // Following two flags control history manipulation as result of navigate
  1457. // SBSP_WRITENOHISTORY -- write no history (shell folder) entry
  1458. // SBSP_NOAUTOSELECT -- suppress selection in history pane
  1459. //
  1460. // IShellBrowser::GetViewStateStream(grfMode, ppstm)
  1461. //
  1462. // The browser returns an IStream interface as the storage for view
  1463. // specific state information.
  1464. //
  1465. // grfMode -- Specifies the read/write access (STGM_READ/WRITE/READWRITE)
  1466. // ppstm -- Specifies the LPSTREAM variable to be filled.
  1467. //
  1468. //
  1469. // IShellBrowser::GetControlWindow(id, phwnd)
  1470. //
  1471. // The shell view may call this member function to get the window handle
  1472. // of Explorer controls (toolbar or status winodw -- FCW_TOOLBAR or
  1473. // FCW_STATUS).
  1474. //
  1475. //
  1476. // IShellBrowser::SendControlMsg(id, uMsg, wParam, lParam, pret)
  1477. //
  1478. // The shell view calls this member function to send control messages to
  1479. // one of Explorer controls (toolbar or status window -- FCW_TOOLBAR or
  1480. // FCW_STATUS).
  1481. //
  1482. //
  1483. // IShellBrowser::QueryActiveShellView(IShellView * ppshv)
  1484. //
  1485. // This member returns currently activated (displayed) shellview object.
  1486. // A shellview never need to call this member function.
  1487. //
  1488. //
  1489. // IShellBrowser::OnViewWindowActive(pshv)
  1490. //
  1491. // The shell view window calls this member function when the view window
  1492. // (or one of its children) got the focus. It MUST call this member before
  1493. // calling IShellBrowser::InsertMenus, because it will insert different
  1494. // set of menu items depending on whether the view has the focus or not.
  1495. //
  1496. //
  1497. // IShellBrowser::SetToolbarItems(lpButtons, nButtons, uFlags)
  1498. //
  1499. // The view calls this function to add toolbar items to the exporer's
  1500. // toolbar. "lpButtons" and "nButtons" specifies the array of toolbar
  1501. // items. "uFlags" must be one of FCT_MERGE, FCT_CONFIGABLE, FCT_ADDTOEND.
  1502. //
  1503. //-------------------------------------------------------------------------
  1504. //
  1505. // Values for wFlags parameter of ISB::BrowseObject() member.
  1506. //
  1507. #define SBSP_DEFBROWSER 0x0000
  1508. #define SBSP_SAMEBROWSER 0x0001
  1509. #define SBSP_NEWBROWSER 0x0002
  1510. #define SBSP_DEFMODE 0x0000
  1511. #define SBSP_OPENMODE 0x0010
  1512. #define SBSP_EXPLOREMODE 0x0020
  1513. #define SBSP_ABSOLUTE 0x0000
  1514. #define SBSP_RELATIVE 0x1000
  1515. #define SBSP_PARENT 0x2000
  1516. #define SBSP_NAVIGATEBACK 0x4000
  1517. #define SBSP_NAVIGATEFORWARD 0x8000
  1518. #define SBSP_ALLOW_AUTONAVIGATE 0x10000
  1519. #define SBSP_INITIATEDBYHLINKFRAME 0x80000000
  1520. #define SBSP_REDIRECT 0x40000000
  1521. #define SBSP_WRITENOHISTORY 0x08000000
  1522. #define SBSP_NOAUTOSELECT 0x04000000
  1523. //
  1524. // Values for id parameter of ISB::GetWindow/SendControlMsg members.
  1525. //
  1526. // WARNING:
  1527. // Any shell extensions which sends messages to those control windows
  1528. // might not work in the future version of windows. If you really need
  1529. // to send messages to them, (1) don't assume that those control window
  1530. // always exist (i.e. GetControlWindow may fail) and (2) verify the window
  1531. // class of the window before sending any messages.
  1532. //
  1533. #define FCW_STATUS 0x0001
  1534. #define FCW_TOOLBAR 0x0002
  1535. #define FCW_TREE 0x0003
  1536. #define FCW_INTERNETBAR 0x0006
  1537. #define FCW_PROGRESS 0x0008
  1538. #if (_WIN32_IE >= 0x0400)
  1539. #endif
  1540. //
  1541. // Values for uFlags paremeter of ISB::SetToolbarItems member.
  1542. //
  1543. #define FCT_MERGE 0x0001
  1544. #define FCT_CONFIGABLE 0x0002
  1545. #define FCT_ADDTOEND 0x0004
  1546. #undef INTERFACE
  1547. #define INTERFACE IShellBrowser
  1548. DECLARE_INTERFACE_(IShellBrowser, IOleWindow)
  1549. {
  1550. // *** IUnknown methods ***
  1551. STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  1552. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  1553. STDMETHOD_(ULONG,Release) (THIS) PURE;
  1554. // *** IOleWindow methods ***
  1555. STDMETHOD(GetWindow) (THIS_ HWND * lphwnd) PURE;
  1556. STDMETHOD(ContextSensitiveHelp) (THIS_ BOOL fEnterMode) PURE;
  1557. // *** IShellBrowser methods *** (same as IOleInPlaceFrame)
  1558. STDMETHOD(InsertMenusSB) (THIS_ HMENU hmenuShared,
  1559. LPOLEMENUGROUPWIDTHS lpMenuWidths) PURE;
  1560. STDMETHOD(SetMenuSB) (THIS_ HMENU hmenuShared, HOLEMENU holemenuReserved,
  1561. HWND hwndActiveObject) PURE;
  1562. STDMETHOD(RemoveMenusSB) (THIS_ HMENU hmenuShared) PURE;
  1563. STDMETHOD(SetStatusTextSB) (THIS_ LPCOLESTR lpszStatusText) PURE;
  1564. STDMETHOD(EnableModelessSB) (THIS_ BOOL fEnable) PURE;
  1565. STDMETHOD(TranslateAcceleratorSB) (THIS_ LPMSG lpmsg, WORD wID) PURE;
  1566. // *** IShellBrowser methods ***
  1567. STDMETHOD(BrowseObject)(THIS_ LPCITEMIDLIST pidl, UINT wFlags) PURE;
  1568. STDMETHOD(GetViewStateStream)(THIS_ DWORD grfMode,
  1569. LPSTREAM *ppStrm) PURE;
  1570. STDMETHOD(GetControlWindow)(THIS_ UINT id, HWND * lphwnd) PURE;
  1571. STDMETHOD(SendControlMsg)(THIS_ UINT id, UINT uMsg, WPARAM wParam,
  1572. LPARAM lParam, LRESULT * pret) PURE;
  1573. STDMETHOD(QueryActiveShellView)(THIS_ struct IShellView ** ppshv) PURE;
  1574. STDMETHOD(OnViewWindowActive)(THIS_ struct IShellView * ppshv) PURE;
  1575. STDMETHOD(SetToolbarItems)(THIS_ LPTBBUTTON lpButtons, UINT nButtons,
  1576. UINT uFlags) PURE;
  1577. };
  1578. #define __IShellBrowser_INTERFACE_DEFINED__
  1579. typedef IShellBrowser * LPSHELLBROWSER;
  1580. enum {
  1581. SBSC_HIDE = 0,
  1582. SBSC_SHOW = 1,
  1583. SBSC_TOGGLE = 2,
  1584. SBSC_QUERY = 3
  1585. };
  1586. enum {
  1587. SBO_DEFAULT = 0 ,
  1588. SBO_NOBROWSERPAGES = 1
  1589. };
  1590. #if (_WIN32_IE >= 0x0400)
  1591. #endif
  1592. //-------------------------------------------------------------------------
  1593. // ICommDlgBrowser interface
  1594. //
  1595. // ICommDlgBrowser interface is the interface that is provided by the new
  1596. // common dialog window to hook and modify the behavior of IShellView. When
  1597. // a default view is created, it queries its parent IShellBrowser for the
  1598. // ICommDlgBrowser interface. If supported, it calls out to that interface
  1599. // in several cases that need to behave differently in a dialog.
  1600. //
  1601. // Member functions:
  1602. //
  1603. // ICommDlgBrowser::OnDefaultCommand()
  1604. // Called when the user double-clicks in the view or presses Enter. The
  1605. // browser should return S_OK if it processed the action itself, S_FALSE
  1606. // to let the view perform the default action.
  1607. //
  1608. // ICommDlgBrowser::OnStateChange(ULONG uChange)
  1609. // Called when some states in the view change. 'uChange' is one of the
  1610. // CDBOSC_* values. This call is made after the state (selection, focus,
  1611. // etc) has changed. There is no return value.
  1612. //
  1613. // ICommDlgBrowser::IncludeObject(LPCITEMIDLIST pidl)
  1614. // Called when the view is enumerating objects. 'pidl' is a relative
  1615. // IDLIST. The browser should return S_OK to include the object in the
  1616. // view, S_FALSE to hide it
  1617. //
  1618. //-------------------------------------------------------------------------
  1619. #define CDBOSC_SETFOCUS 0x00000000
  1620. #define CDBOSC_KILLFOCUS 0x00000001
  1621. #define CDBOSC_SELCHANGE 0x00000002
  1622. #define CDBOSC_RENAME 0x00000003
  1623. #undef INTERFACE
  1624. #define INTERFACE ICommDlgBrowser
  1625. DECLARE_INTERFACE_(ICommDlgBrowser, IUnknown)
  1626. {
  1627. // *** IUnknown methods ***
  1628. STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  1629. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  1630. STDMETHOD_(ULONG,Release) (THIS) PURE;
  1631. // *** ICommDlgBrowser methods ***
  1632. STDMETHOD(OnDefaultCommand) (THIS_ struct IShellView * ppshv) PURE;
  1633. STDMETHOD(OnStateChange) (THIS_ struct IShellView * ppshv,
  1634. ULONG uChange) PURE;
  1635. STDMETHOD(IncludeObject) (THIS_ struct IShellView * ppshv,
  1636. LPCITEMIDLIST pidl) PURE;
  1637. };
  1638. typedef ICommDlgBrowser * LPCOMMDLGBROWSER;
  1639. //==========================================================================
  1640. //
  1641. // Interface: IShellView
  1642. //
  1643. // IShellView::GetWindow(phwnd)
  1644. //
  1645. // Inherited from IOleWindow::GetWindow.
  1646. //
  1647. //
  1648. // IShellView::ContextSensitiveHelp(fEnterMode)
  1649. //
  1650. // Inherited from IOleWindow::ContextSensitiveHelp.
  1651. //
  1652. //
  1653. // IShellView::TranslateAccelerator(lpmsg)
  1654. //
  1655. // Similar to IOleInPlaceActiveObject::TranlateAccelerator. The explorer
  1656. // calls this function BEFORE any other translation. Returning S_OK
  1657. // indicates that the message was translated (eaten) and should not be
  1658. // translated or dispatched by the explorer.
  1659. //
  1660. //
  1661. // IShellView::EnableModeless(fEnable)
  1662. // Similar to IOleInPlaceActiveObject::EnableModeless.
  1663. //
  1664. //
  1665. // IShellView::UIActivate(uState)
  1666. //
  1667. // The explorer calls this member function whenever the activation
  1668. // state of the view window is changed by a certain event that is
  1669. // NOT caused by the shell view itself.
  1670. //
  1671. // SVUIA_DEACTIVATE will be passed when the explorer is about to
  1672. // destroy the shell view window; the shell view is supposed to remove
  1673. // all the extended UIs (typically merged menu and modeless popup windows).
  1674. //
  1675. // SVUIA_ACTIVATE_NOFOCUS will be passsed when the shell view is losing
  1676. // the input focus or the shell view has been just created without the
  1677. // input focus; the shell view is supposed to set menuitems appropriate
  1678. // for non-focused state (no selection specific items should be added).
  1679. //
  1680. // SVUIA_ACTIVATE_FOCUS will be passed when the explorer has just
  1681. // created the view window with the input focus; the shell view is
  1682. // supposed to set menuitems appropriate for focused state.
  1683. //
  1684. // SVUIA_INPLACEACTIVATE(new) will be passed when the shell view is opened
  1685. // within an ActiveX control, which is not a UI active. In this case,
  1686. // the shell view should not merge menus or put toolbas. To be compatible
  1687. // with Win95 client, we don't pass this value unless the view supports
  1688. // IShellView2.
  1689. //
  1690. // The shell view should not change focus within this member function.
  1691. // The shell view should not hook the WM_KILLFOCUS message to remerge
  1692. // menuitems. However, the shell view typically hook the WM_SETFOCUS
  1693. // message, and re-merge the menu after calling IShellBrowser::
  1694. // OnViewWindowActivated.
  1695. //
  1696. //
  1697. // IShellView::Refresh()
  1698. //
  1699. // The explorer calls this member when the view needs to refresh its
  1700. // contents (such as when the user hits F5 key).
  1701. //
  1702. //
  1703. // IShellView::CreateViewWindow
  1704. //
  1705. // This member creates the view window (right-pane of the explorer or the
  1706. // client window of the folder window).
  1707. //
  1708. //
  1709. // IShellView::DestroyViewWindow
  1710. //
  1711. // This member destroys the view window.
  1712. //
  1713. //
  1714. // IShellView::GetCurrentInfo
  1715. //
  1716. // This member returns the folder settings.
  1717. //
  1718. //
  1719. // IShellView::AddPropertySHeetPages
  1720. //
  1721. // The explorer calls this member when it is opening the option property
  1722. // sheet. This allows the view to add additional pages to it.
  1723. //
  1724. //
  1725. // IShellView::SaveViewState()
  1726. //
  1727. // The explorer calls this member when the shell view is supposed to
  1728. // store its view settings. The shell view is supposed to get a view
  1729. // stream by calling IShellBrowser::GetViewStateStream and store the
  1730. // current view state into that stream.
  1731. //
  1732. //
  1733. // IShellView::SelectItem(pidlItem, uFlags)
  1734. //
  1735. // The explorer calls this member to change the selection state of
  1736. // item(s) within the shell view window. If pidlItem is NULL and uFlags
  1737. // is SVSI_DESELECTOTHERS, all items should be deselected.
  1738. //
  1739. //-------------------------------------------------------------------------
  1740. //
  1741. // shellview select item flags
  1742. //
  1743. #define SVSI_DESELECT 0x0000
  1744. #define SVSI_SELECT 0x0001
  1745. #define SVSI_EDIT 0x0003 // includes select
  1746. #define SVSI_DESELECTOTHERS 0x0004
  1747. #define SVSI_ENSUREVISIBLE 0x0008
  1748. #define SVSI_FOCUSED 0x0010
  1749. #define SVSI_TRANSLATEPT 0x0020
  1750. //
  1751. // shellview get item object flags
  1752. //
  1753. #define SVGIO_BACKGROUND 0x00000000
  1754. #define SVGIO_SELECTION 0x00000001
  1755. #define SVGIO_ALLVIEW 0x00000002
  1756. //
  1757. // uState values for IShellView::UIActivate
  1758. //
  1759. typedef enum {
  1760. SVUIA_DEACTIVATE = 0,
  1761. SVUIA_ACTIVATE_NOFOCUS = 1,
  1762. SVUIA_ACTIVATE_FOCUS = 2,
  1763. SVUIA_INPLACEACTIVATE = 3 // new flag for IShellView2
  1764. } SVUIA_STATUS;
  1765. #undef INTERFACE
  1766. #define INTERFACE IShellView
  1767. DECLARE_INTERFACE_(IShellView, IOleWindow)
  1768. {
  1769. // *** IUnknown methods ***
  1770. STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  1771. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  1772. STDMETHOD_(ULONG,Release) (THIS) PURE;
  1773. // *** IOleWindow methods ***
  1774. STDMETHOD(GetWindow) (THIS_ HWND * lphwnd) PURE;
  1775. STDMETHOD(ContextSensitiveHelp) (THIS_ BOOL fEnterMode) PURE;
  1776. // *** IShellView methods ***
  1777. STDMETHOD(TranslateAccelerator) (THIS_ LPMSG lpmsg) PURE;
  1778. #ifdef _FIX_ENABLEMODELESS_CONFLICT
  1779. STDMETHOD(EnableModelessSV) (THIS_ BOOL fEnable) PURE;
  1780. #else
  1781. STDMETHOD(EnableModeless) (THIS_ BOOL fEnable) PURE;
  1782. #endif
  1783. STDMETHOD(UIActivate) (THIS_ UINT uState) PURE;
  1784. STDMETHOD(Refresh) (THIS) PURE;
  1785. STDMETHOD(CreateViewWindow)(THIS_ IShellView *lpPrevView,
  1786. LPCFOLDERSETTINGS lpfs, IShellBrowser * psb,
  1787. RECT * prcView, HWND *phWnd) PURE;
  1788. STDMETHOD(DestroyViewWindow)(THIS) PURE;
  1789. STDMETHOD(GetCurrentInfo)(THIS_ LPFOLDERSETTINGS lpfs) PURE;
  1790. STDMETHOD(AddPropertySheetPages)(THIS_ DWORD dwReserved,
  1791. LPFNADDPROPSHEETPAGE lpfn, LPARAM lparam) PURE;
  1792. STDMETHOD(SaveViewState)(THIS) PURE;
  1793. STDMETHOD(SelectItem)(THIS_ LPCITEMIDLIST pidlItem, UINT uFlags) PURE;
  1794. STDMETHOD(GetItemObject)(THIS_ UINT uItem, REFIID riid,
  1795. LPVOID *ppv) PURE;
  1796. };
  1797. typedef IShellView * LPSHELLVIEW;
  1798. typedef GUID SHELLVIEWID;
  1799. #define SV2GV_CURRENTVIEW ((UINT)-1)
  1800. #define SV2GV_DEFAULTVIEW ((UINT)-2)
  1801. #include <pshpack8.h>
  1802. typedef struct _SV2CVW2_PARAMS
  1803. {
  1804. DWORD cbSize;
  1805. IShellView *psvPrev;
  1806. FOLDERSETTINGS const *pfs;
  1807. IShellBrowser *psbOwner;
  1808. RECT *prcView;
  1809. SHELLVIEWID const *pvid;
  1810. HWND hwndView;
  1811. } SV2CVW2_PARAMS;
  1812. typedef SV2CVW2_PARAMS *LPSV2CVW2_PARAMS;
  1813. #include <poppack.h>
  1814. #undef INTERFACE
  1815. #define INTERFACE IShellView2
  1816. DECLARE_INTERFACE_(IShellView2, IShellView)
  1817. {
  1818. // *** IUnknown methods ***
  1819. STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  1820. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  1821. STDMETHOD_(ULONG,Release) (THIS) PURE;
  1822. // *** IOleWindow methods ***
  1823. STDMETHOD(GetWindow) (THIS_ HWND * lphwnd) PURE;
  1824. STDMETHOD(ContextSensitiveHelp) (THIS_ BOOL fEnterMode) PURE;
  1825. // *** IShellView methods ***
  1826. STDMETHOD(TranslateAccelerator) (THIS_ LPMSG lpmsg) PURE;
  1827. #ifdef _FIX_ENABLEMODELESS_CONFLICT
  1828. STDMETHOD(EnableModelessSV) (THIS_ BOOL fEnable) PURE;
  1829. #else
  1830. STDMETHOD(EnableModeless) (THIS_ BOOL fEnable) PURE;
  1831. #endif
  1832. STDMETHOD(UIActivate) (THIS_ UINT uState) PURE;
  1833. STDMETHOD(Refresh) (THIS) PURE;
  1834. STDMETHOD(CreateViewWindow)(THIS_ IShellView *lpPrevView,
  1835. LPCFOLDERSETTINGS lpfs, IShellBrowser * psb,
  1836. RECT * prcView, HWND *phWnd) PURE;
  1837. STDMETHOD(DestroyViewWindow)(THIS) PURE;
  1838. STDMETHOD(GetCurrentInfo)(THIS_ LPFOLDERSETTINGS lpfs) PURE;
  1839. STDMETHOD(AddPropertySheetPages)(THIS_ DWORD dwReserved,
  1840. LPFNADDPROPSHEETPAGE lpfn, LPARAM lparam) PURE;
  1841. STDMETHOD(SaveViewState)(THIS) PURE;
  1842. STDMETHOD(SelectItem)(THIS_ LPCITEMIDLIST pidlItem, UINT uFlags) PURE;
  1843. STDMETHOD(GetItemObject)(THIS_ UINT uItem, REFIID riid,
  1844. LPVOID *ppv) PURE;
  1845. // *** IShellView2 methods ***
  1846. STDMETHOD(GetView)(THIS_ SHELLVIEWID* pvid, ULONG uView) PURE;
  1847. STDMETHOD(CreateViewWindow2)(THIS_ LPSV2CVW2_PARAMS lpParams) PURE;
  1848. STDMETHOD(HandleRename)(THIS_ LPCITEMIDLIST pidlNew) PURE;
  1849. STDMETHOD(SelectAndPositionItem) (THIS_ LPCITEMIDLIST pidlItem,
  1850. UINT uFlags,POINT* point) PURE;
  1851. };
  1852. //-------------------------------------------------------------------------
  1853. //
  1854. // struct STRRET
  1855. //
  1856. // structure for returning strings from IShellFolder member functions
  1857. //
  1858. //-------------------------------------------------------------------------
  1859. #define STRRET_WSTR 0x0000 // Use STRRET.pOleStr
  1860. #define STRRET_OFFSET 0x0001 // Use STRRET.uOffset to Ansi
  1861. #define STRRET_CSTR 0x0002 // Use STRRET.cStr
  1862. typedef struct _STRRET
  1863. {
  1864. UINT uType; // One of the STRRET_* values
  1865. union
  1866. {
  1867. LPWSTR pOleStr; // must be freed by caller of GetDisplayNameOf
  1868. LPSTR pStr; // NOT USED
  1869. UINT uOffset; // Offset into SHITEMID
  1870. char cStr[MAX_PATH]; // Buffer to fill in (ANSI)
  1871. } DUMMYUNIONNAME;
  1872. } STRRET, *LPSTRRET;
  1873. //-------------------------------------------------------------------------
  1874. //
  1875. // SHGetPathFromIDList
  1876. //
  1877. // This function assumes the size of the buffer (MAX_PATH). The pidl
  1878. // should point to a file system object.
  1879. //
  1880. //-------------------------------------------------------------------------
  1881. WINSHELLAPI BOOL WINAPI SHGetPathFromIDListA(LPCITEMIDLIST pidl, LPSTR pszPath);
  1882. WINSHELLAPI BOOL WINAPI SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath);
  1883. #ifdef UNICODE
  1884. #define SHGetPathFromIDList SHGetPathFromIDListW
  1885. #else
  1886. #define SHGetPathFromIDList SHGetPathFromIDListA
  1887. #endif
  1888. //-------------------------------------------------------------------------
  1889. //
  1890. // SHGetSpecialFolderLocation
  1891. //
  1892. // Caller should use SHGetMalloc to obtain an allocator that can free the pidl
  1893. //
  1894. //
  1895. //-------------------------------------------------------------------------
  1896. //
  1897. // registry entries for special paths are kept in :
  1898. #define REGSTR_PATH_SPECIAL_FOLDERS REGSTR_PATH_EXPLORER TEXT("\\Shell Folders")
  1899. #define CSIDL_DESKTOP 0x0000
  1900. #define CSIDL_INTERNET 0x0001
  1901. #define CSIDL_PROGRAMS 0x0002
  1902. #define CSIDL_CONTROLS 0x0003
  1903. #define CSIDL_PRINTERS 0x0004
  1904. #define CSIDL_PERSONAL 0x0005
  1905. #define CSIDL_FAVORITES 0x0006
  1906. #define CSIDL_STARTUP 0x0007
  1907. #define CSIDL_RECENT 0x0008
  1908. #define CSIDL_SENDTO 0x0009
  1909. #define CSIDL_BITBUCKET 0x000a
  1910. #define CSIDL_STARTMENU 0x000b
  1911. #define CSIDL_DESKTOPDIRECTORY 0x0010
  1912. #define CSIDL_DRIVES 0x0011
  1913. #define CSIDL_NETWORK 0x0012
  1914. #define CSIDL_NETHOOD 0x0013
  1915. #define CSIDL_FONTS 0x0014
  1916. #define CSIDL_TEMPLATES 0x0015
  1917. #define CSIDL_COMMON_STARTMENU 0x0016
  1918. #define CSIDL_COMMON_PROGRAMS 0X0017
  1919. #define CSIDL_COMMON_STARTUP 0x0018
  1920. #define CSIDL_COMMON_DESKTOPDIRECTORY 0x0019
  1921. #define CSIDL_APPDATA 0x001a
  1922. #define CSIDL_PRINTHOOD 0x001b
  1923. #define CSIDL_ALTSTARTUP 0x001d // DBCS
  1924. #define CSIDL_COMMON_ALTSTARTUP 0x001e // DBCS
  1925. #define CSIDL_COMMON_FAVORITES 0x001f
  1926. #define CSIDL_INTERNET_CACHE 0x0020
  1927. #define CSIDL_COOKIES 0x0021
  1928. #define CSIDL_HISTORY 0x0022
  1929. WINSHELLAPI HRESULT WINAPI SHGetSpecialFolderLocation(HWND hwndOwner, int nFolder, LPITEMIDLIST * ppidl);
  1930. #if (_WIN32_IE >= 0x0400)
  1931. WINSHELLAPI BOOL WINAPI SHGetSpecialFolderPathA(HWND hwndOwner, LPSTR lpszPath, int nFolder, BOOL fCreate);
  1932. WINSHELLAPI BOOL WINAPI SHGetSpecialFolderPathW(HWND hwndOwner, LPWSTR lpszPath, int nFolder, BOOL fCreate);
  1933. #ifdef UNICODE
  1934. #define SHGetSpecialFolderPath SHGetSpecialFolderPathW
  1935. #else
  1936. #define SHGetSpecialFolderPath SHGetSpecialFolderPathA
  1937. #endif
  1938. #endif // _WIN32_IE >= 0x0400
  1939. //-------------------------------------------------------------------------
  1940. //
  1941. // SHBrowseForFolder API
  1942. //
  1943. //-------------------------------------------------------------------------
  1944. typedef int (CALLBACK* BFFCALLBACK)(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData);
  1945. typedef struct _browseinfoA {
  1946. HWND hwndOwner;
  1947. LPCITEMIDLIST pidlRoot;
  1948. LPSTR pszDisplayName;// Return display name of item selected.
  1949. LPCSTR lpszTitle; // text to go in the banner over the tree.
  1950. UINT ulFlags; // Flags that control the return stuff
  1951. BFFCALLBACK lpfn;
  1952. LPARAM lParam; // extra info that's passed back in callbacks
  1953. int iImage; // output var: where to return the Image index.
  1954. } BROWSEINFOA, *PBROWSEINFOA, *LPBROWSEINFOA;
  1955. typedef struct _browseinfoW {
  1956. HWND hwndOwner;
  1957. LPCITEMIDLIST pidlRoot;
  1958. LPWSTR pszDisplayName;// Return display name of item selected.
  1959. LPCWSTR lpszTitle; // text to go in the banner over the tree.
  1960. UINT ulFlags; // Flags that control the return stuff
  1961. BFFCALLBACK lpfn;
  1962. LPARAM lParam; // extra info that's passed back in callbacks
  1963. int iImage; // output var: where to return the Image index.
  1964. } BROWSEINFOW, *PBROWSEINFOW, *LPBROWSEINFOW;
  1965. #ifdef UNICODE
  1966. #define BROWSEINFO BROWSEINFOW
  1967. #define PBROWSEINFO PBROWSEINFOW
  1968. #define LPBROWSEINFO LPBROWSEINFOW
  1969. #else
  1970. #define BROWSEINFO BROWSEINFOA
  1971. #define PBROWSEINFO PBROWSEINFOA
  1972. #define LPBROWSEINFO LPBROWSEINFOA
  1973. #endif
  1974. // Browsing for directory.
  1975. #define BIF_RETURNONLYFSDIRS 0x0001 // For finding a folder to start document searching
  1976. #define BIF_DONTGOBELOWDOMAIN 0x0002 // For starting the Find Computer
  1977. #define BIF_STATUSTEXT 0x0004
  1978. #define BIF_RETURNFSANCESTORS 0x0008
  1979. #define BIF_EDITBOX 0x0010
  1980. #define BIF_VALIDATE 0x0020 // insist on valid result (or CANCEL)
  1981. #define BIF_BROWSEFORCOMPUTER 0x1000 // Browsing for Computers.
  1982. #define BIF_BROWSEFORPRINTER 0x2000 // Browsing for Printers
  1983. #define BIF_BROWSEINCLUDEFILES 0x4000 // Browsing for Everything
  1984. // message from browser
  1985. #define BFFM_INITIALIZED 1
  1986. #define BFFM_SELCHANGED 2
  1987. #define BFFM_VALIDATEFAILEDA 3 // lParam:szPath ret:1(cont),0(EndDialog)
  1988. #define BFFM_VALIDATEFAILEDW 4 // lParam:wzPath ret:1(cont),0(EndDialog)
  1989. // messages to browser
  1990. #define BFFM_SETSTATUSTEXTA (WM_USER + 100)
  1991. #define BFFM_ENABLEOK (WM_USER + 101)
  1992. #define BFFM_SETSELECTIONA (WM_USER + 102)
  1993. #define BFFM_SETSELECTIONW (WM_USER + 103)
  1994. #define BFFM_SETSTATUSTEXTW (WM_USER + 104)
  1995. WINSHELLAPI LPITEMIDLIST WINAPI SHBrowseForFolderA(LPBROWSEINFOA lpbi);
  1996. WINSHELLAPI LPITEMIDLIST WINAPI SHBrowseForFolderW(LPBROWSEINFOW lpbi);
  1997. #ifdef UNICODE
  1998. #define SHBrowseForFolder SHBrowseForFolderW
  1999. #define BFFM_SETSTATUSTEXT BFFM_SETSTATUSTEXTW
  2000. #define BFFM_SETSELECTION BFFM_SETSELECTIONW
  2001. #define BFFM_VALIDATEFAILED BFFM_VALIDATEFAILEDW
  2002. #else
  2003. #define SHBrowseForFolder SHBrowseForFolderA
  2004. #define BFFM_SETSTATUSTEXT BFFM_SETSTATUSTEXTA
  2005. #define BFFM_SETSELECTION BFFM_SETSELECTIONA
  2006. #define BFFM_VALIDATEFAILED BFFM_VALIDATEFAILEDA
  2007. #endif
  2008. //-------------------------------------------------------------------------
  2009. //
  2010. // SHLoadInProc
  2011. //
  2012. // When this function is called, the shell calls CoCreateInstance
  2013. // (or equivalent) with CLSCTX_INPROC_SERVER and the specified CLSID
  2014. // from within the shell's process and release it immediately.
  2015. //
  2016. //-------------------------------------------------------------------------
  2017. WINSHELLAPI HRESULT WINAPI SHLoadInProc(REFCLSID rclsid);
  2018. //-------------------------------------------------------------------------
  2019. //
  2020. // IEnumIDList interface
  2021. //
  2022. // IShellFolder::EnumObjects member returns an IEnumIDList object.
  2023. //
  2024. //-------------------------------------------------------------------------
  2025. typedef struct IEnumIDList *LPENUMIDLIST;
  2026. #undef INTERFACE
  2027. #define INTERFACE IEnumIDList
  2028. DECLARE_INTERFACE_(IEnumIDList, IUnknown)
  2029. {
  2030. // *** IUnknown methods ***
  2031. STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  2032. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  2033. STDMETHOD_(ULONG,Release) (THIS) PURE;
  2034. // *** IEnumIDList methods ***
  2035. STDMETHOD(Next) (THIS_ ULONG celt,
  2036. LPITEMIDLIST *rgelt,
  2037. ULONG *pceltFetched) PURE;
  2038. STDMETHOD(Skip) (THIS_ ULONG celt) PURE;
  2039. STDMETHOD(Reset) (THIS) PURE;
  2040. STDMETHOD(Clone) (THIS_ IEnumIDList **ppenum) PURE;
  2041. };
  2042. //-------------------------------------------------------------------------
  2043. //
  2044. // IShellFolder interface
  2045. //
  2046. //
  2047. // [Member functions]
  2048. //
  2049. // IShellFolder::BindToObject(pidl, pbc, riid, ppvOut)
  2050. // This function returns an instance of a sub-folder which is specified
  2051. // by the IDList (pidl).
  2052. //
  2053. // IShellFolder::BindToStorage(pidl, pbc, riid, ppvObj)
  2054. // This function returns a storage instance of a sub-folder which is
  2055. // specified by the IDList (pidl). The shell never calls this member
  2056. // function in the first release of Win95.
  2057. //
  2058. // IShellFolder::CompareIDs(lParam, pidl1, pidl2)
  2059. // This function compares two IDLists and returns the result. The shell
  2060. // explorer always passes 0 as lParam, which indicates "sort by name".
  2061. // It should return 0 (as CODE of the scode), if two id indicates the
  2062. // same object; negative value if pidl1 should be placed before pidl2;
  2063. // positive value if pidl2 should be placed before pidl1.
  2064. //
  2065. // IShellFolder::CreateViewObject(hwndOwner, riid, ppvOut)
  2066. // This function creates a view object of the folder itself. The view
  2067. // object is a difference instance from the shell folder object.
  2068. // "hwndOwner" can be used as the owner window of its dialog box or
  2069. // menu during the lifetime of the view object.
  2070. // instance which has only one reference count. The explorer may create
  2071. // more than one instances of view object from one shell folder object
  2072. // and treat them as separate instances.
  2073. //
  2074. // IShellFolder::GetAttributesOf(cidl, apidl, prgfInOut)
  2075. // This function returns the attributes of specified objects in that
  2076. // folder. "cidl" and "apidl" specifies objects. "apidl" contains only
  2077. // simple IDLists. The explorer initializes *prgfInOut with a set of
  2078. // flags to be evaluated. The shell folder may optimize the operation
  2079. // by not returning unspecified flags.
  2080. //
  2081. // IShellFolder::GetUIObjectOf(hwndOwner, cidl, apidl, riid, prgfInOut, ppvOut)
  2082. // This function creates a UI object to be used for specified objects.
  2083. // The shell explorer passes either IID_IDataObject (for transfer operation)
  2084. // or IID_IContextMenu (for context menu operation) as riid.
  2085. //
  2086. // IShellFolder::GetDisplayNameOf
  2087. // This function returns the display name of the specified object.
  2088. // If the ID contains the display name (in the locale character set),
  2089. // it returns the offset to the name. Otherwise, it returns a pointer
  2090. // to the display name string (UNICODE), which is allocated by the
  2091. // task allocator, or fills in a buffer.
  2092. //
  2093. // IShellFolder::SetNameOf
  2094. // This function sets the display name of the specified object.
  2095. // If it changes the ID as well, it returns the new ID which is
  2096. // alocated by the task allocator.
  2097. //
  2098. //-------------------------------------------------------------------------
  2099. // IShellFolder::GetDisplayNameOf/SetNameOf uFlags
  2100. typedef enum tagSHGDN
  2101. {
  2102. SHGDN_NORMAL = 0, // default (display purpose)
  2103. SHGDN_INFOLDER = 1, // displayed under a folder (relative)
  2104. SHGDN_INCLUDE_NONFILESYS = 0x2000, // if not set, display names for shell name space items that are not in the file system will fail.
  2105. SHGDN_FORADDRESSBAR = 0x4000, // for displaying in the address (drives dropdown) bar
  2106. SHGDN_FORPARSING = 0x8000, // for ParseDisplayName or path
  2107. } SHGNO;
  2108. // IShellFolder::EnumObjects
  2109. typedef enum tagSHCONTF
  2110. {
  2111. SHCONTF_FOLDERS = 32, // for shell browser
  2112. SHCONTF_NONFOLDERS = 64, // for default view
  2113. SHCONTF_INCLUDEHIDDEN = 128, // for hidden/system objects
  2114. } SHCONTF;
  2115. // IShellFolder::GetAttributesOf flags
  2116. #define SFGAO_CANCOPY DROPEFFECT_COPY // Objects can be copied
  2117. #define SFGAO_CANMOVE DROPEFFECT_MOVE // Objects can be moved
  2118. #define SFGAO_CANLINK DROPEFFECT_LINK // Objects can be linked
  2119. #define SFGAO_CANRENAME 0x00000010L // Objects can be renamed
  2120. #define SFGAO_CANDELETE 0x00000020L // Objects can be deleted
  2121. #define SFGAO_HASPROPSHEET 0x00000040L // Objects have property sheets
  2122. #define SFGAO_DROPTARGET 0x00000100L // Objects are drop target
  2123. #define SFGAO_CAPABILITYMASK 0x00000177L
  2124. #define SFGAO_LINK 0x00010000L // Shortcut (link)
  2125. #define SFGAO_SHARE 0x00020000L // shared
  2126. #define SFGAO_READONLY 0x00040000L // read-only
  2127. #define SFGAO_GHOSTED 0x00080000L // ghosted icon
  2128. #define SFGAO_HIDDEN 0x00080000L // hidden object
  2129. #define SFGAO_DISPLAYATTRMASK 0x000F0000L
  2130. #define SFGAO_FILESYSANCESTOR 0x10000000L // It contains file system folder
  2131. #define SFGAO_FOLDER 0x20000000L // It's a folder.
  2132. #define SFGAO_FILESYSTEM 0x40000000L // is a file system thing (file/folder/root)
  2133. #define SFGAO_HASSUBFOLDER 0x80000000L // Expandable in the map pane
  2134. #define SFGAO_CONTENTSMASK 0x80000000L
  2135. #define SFGAO_VALIDATE 0x01000000L // invalidate cached information
  2136. #define SFGAO_REMOVABLE 0x02000000L // is this removeable media?
  2137. #define SFGAO_COMPRESSED 0x04000000L // Object is compressed (use alt color)
  2138. #define SFGAO_BROWSABLE 0x08000000L // is in-place browsable
  2139. #define SFGAO_NONENUMERATED 0x00100000L // is a non-enumerated object
  2140. #define SFGAO_NEWCONTENT 0x00200000L // should show bold in explorer tree
  2141. #undef INTERFACE
  2142. #define INTERFACE IShellFolder
  2143. DECLARE_INTERFACE_(IShellFolder, IUnknown)
  2144. {
  2145. // *** IUnknown methods ***
  2146. STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  2147. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  2148. STDMETHOD_(ULONG,Release) (THIS) PURE;
  2149. // *** IShellFolder methods ***
  2150. STDMETHOD(ParseDisplayName) (THIS_ HWND hwndOwner,
  2151. LPBC pbcReserved, LPOLESTR lpszDisplayName,
  2152. ULONG * pchEaten, LPITEMIDLIST * ppidl, ULONG *pdwAttributes) PURE;
  2153. STDMETHOD(EnumObjects) ( THIS_ HWND hwndOwner, DWORD grfFlags, LPENUMIDLIST * ppenumIDList) PURE;
  2154. STDMETHOD(BindToObject) (THIS_ LPCITEMIDLIST pidl, LPBC pbcReserved,
  2155. REFIID riid, LPVOID * ppvOut) PURE;
  2156. STDMETHOD(BindToStorage) (THIS_ LPCITEMIDLIST pidl, LPBC pbcReserved,
  2157. REFIID riid, LPVOID * ppvObj) PURE;
  2158. STDMETHOD(CompareIDs) (THIS_ LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2) PURE;
  2159. STDMETHOD(CreateViewObject) (THIS_ HWND hwndOwner, REFIID riid, LPVOID * ppvOut) PURE;
  2160. STDMETHOD(GetAttributesOf) (THIS_ UINT cidl, LPCITEMIDLIST * apidl,
  2161. ULONG * rgfInOut) PURE;
  2162. STDMETHOD(GetUIObjectOf) (THIS_ HWND hwndOwner, UINT cidl, LPCITEMIDLIST * apidl,
  2163. REFIID riid, UINT * prgfInOut, LPVOID * ppvOut) PURE;
  2164. STDMETHOD(GetDisplayNameOf) (THIS_ LPCITEMIDLIST pidl, DWORD uFlags, LPSTRRET lpName) PURE;
  2165. STDMETHOD(SetNameOf) (THIS_ HWND hwndOwner, LPCITEMIDLIST pidl,
  2166. LPCOLESTR lpszName, DWORD uFlags,
  2167. LPITEMIDLIST * ppidlOut) PURE;
  2168. };
  2169. typedef IShellFolder * LPSHELLFOLDER;
  2170. //
  2171. // Helper function which returns a IShellFolder interface to the desktop
  2172. // folder. This is equivalent to call CoCreateInstance with CLSID_ShellDesktop.
  2173. //
  2174. // CoCreateInstance(CLSID_Desktop, NULL,
  2175. // CLSCTX_INPROC, IID_IShellFolder, &pshf);
  2176. //
  2177. WINSHELLAPI HRESULT WINAPI SHGetDesktopFolder(LPSHELLFOLDER *ppshf);
  2178. //==========================================================================
  2179. // IInputObjectSite/IInputObject interfaces
  2180. //
  2181. // These interfaces allow us (or ISVs) to install/update external Internet
  2182. // Toolbar for IE and the shell. The frame will simply get the CLSID from
  2183. // registry (to be defined) and CoCreateInstance it.
  2184. //
  2185. //==========================================================================
  2186. //-------------------------------------------------------------------------
  2187. //
  2188. // IInputObjectSite interface
  2189. //
  2190. // A site implements this interface so the object can communicate
  2191. // focus change to it.
  2192. //
  2193. // [Member functions]
  2194. //
  2195. // IInputObjectSite::OnFocusChangeIS(punkObj, fSetFocus)
  2196. // Object (punkObj) is getting or losing the focus.
  2197. //
  2198. //-------------------------------------------------------------------------
  2199. #undef INTERFACE
  2200. #define INTERFACE IInputObjectSite
  2201. DECLARE_INTERFACE_(IInputObjectSite, IUnknown)
  2202. {
  2203. // *** IUnknown methods ***
  2204. STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  2205. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  2206. STDMETHOD_(ULONG,Release) (THIS) PURE;
  2207. // *** IInputObjectSite specific methods ***
  2208. STDMETHOD(OnFocusChangeIS)(THIS_ IUnknown* punkObj, BOOL fSetFocus) PURE;
  2209. };
  2210. //-------------------------------------------------------------------------
  2211. //
  2212. // IInputObject interface
  2213. //
  2214. // An object implements this interface so the site can communicate
  2215. // activation and accelerator events to it.
  2216. //
  2217. // [Member functions]
  2218. //
  2219. // IInputObject::UIActivateIO(fActivate, lpMsg)
  2220. // Activates or deactivates the object. lpMsg may be NULL. Returns
  2221. // S_OK if the activation succeeded.
  2222. //
  2223. // IInputObject::HasFocusIO()
  2224. // Returns S_OK if the object has the focus, S_FALSE if not.
  2225. //
  2226. // IInputObject::TranslateAcceleratorIO(lpMsg)
  2227. // Allow the object to process the message. Returns S_OK if the
  2228. // message was processed (eaten).
  2229. //
  2230. //-------------------------------------------------------------------------
  2231. #undef INTERFACE
  2232. #define INTERFACE IInputObject
  2233. DECLARE_INTERFACE_(IInputObject, IUnknown)
  2234. {
  2235. // *** IUnknown methods ***
  2236. STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  2237. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  2238. STDMETHOD_(ULONG,Release) (THIS) PURE;
  2239. // *** IInputObject specific methods ***
  2240. STDMETHOD(UIActivateIO)(THIS_ BOOL fActivate, LPMSG lpMsg) PURE;
  2241. STDMETHOD(HasFocusIO)(THIS) PURE;
  2242. STDMETHOD(TranslateAcceleratorIO)(THIS_ LPMSG lpMsg) PURE;
  2243. };
  2244. //==========================================================================
  2245. // IDockingWindowSite/IDockingWindow/IDockingWindowFrame interfaces
  2246. // IInputObjectSite/IInputObject interfaces
  2247. //
  2248. // These interfaces allow us (or ISVs) to install/update external Internet
  2249. // Toolbar for IE and the shell. The frame will simply get the CLSID from
  2250. // registry (to be defined) and CoCreateInstance it.
  2251. //
  2252. //==========================================================================
  2253. //-------------------------------------------------------------------------
  2254. //
  2255. // IDockingWindowSite interface
  2256. //
  2257. // A site implements this interface so the object can negotiate for
  2258. // and inquire about real estate on the site.
  2259. //
  2260. // [Member functions]
  2261. //
  2262. // IDockingWindowSite::GetBorderDW(punkObj, prcBorder)
  2263. // Site returns the bounding rectangle of the given source object
  2264. // (punkObj).
  2265. //
  2266. // IDockingWindowSite::RequestBorderSpaceDW(punkObj, pbw)
  2267. // Object requests that the site makes room for it, as specified in
  2268. // *pbw.
  2269. //
  2270. // IDockingWindowSite::SetBorderSpaceDW(punkObj, pbw)
  2271. // Object requests that the site set the border spacing to the size
  2272. // specified in *pbw.
  2273. //
  2274. //-------------------------------------------------------------------------
  2275. #undef INTERFACE
  2276. #define INTERFACE IDockingWindowSite
  2277. DECLARE_INTERFACE_(IDockingWindowSite, IOleWindow)
  2278. {
  2279. // *** IUnknown methods ***
  2280. STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  2281. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  2282. STDMETHOD_(ULONG,Release) (THIS) PURE;
  2283. // *** IOleWindow methods ***
  2284. STDMETHOD(GetWindow) (THIS_ HWND * lphwnd) PURE;
  2285. STDMETHOD(ContextSensitiveHelp) (THIS_ BOOL fEnterMode) PURE;
  2286. // *** IDockingWindowSite methods ***
  2287. STDMETHOD(GetBorderDW) (THIS_ IUnknown* punkObj, LPRECT prcBorder) PURE;
  2288. STDMETHOD(RequestBorderSpaceDW) (THIS_ IUnknown* punkObj, LPCBORDERWIDTHS pbw) PURE;
  2289. STDMETHOD(SetBorderSpaceDW) (THIS_ IUnknown* punkObj, LPCBORDERWIDTHS pbw) PURE;
  2290. };
  2291. //-------------------------------------------------------------------------
  2292. //
  2293. // IDockingWindowFrame interface
  2294. //
  2295. //
  2296. // [Member functions]
  2297. //
  2298. // IDockingWindowFrame::AddToolbar(punkSrc, pwszItem, dwReserved)
  2299. //
  2300. // IDockingWindowFrame::RemoveToolbar(punkSrc, dwRemoveFlags)
  2301. //
  2302. // IDockingWindowFrame::FindToolbar(pwszItem, riid, ppvObj)
  2303. //
  2304. //-------------------------------------------------------------------------
  2305. // flags for RemoveToolbar
  2306. #define DWFRF_NORMAL 0x0000
  2307. #define DWFRF_DELETECONFIGDATA 0x0001
  2308. // flags for AddToolbar
  2309. #define DWFAF_HIDDEN 0x0001 // add hidden
  2310. #undef INTERFACE
  2311. #define INTERFACE IDockingWindowFrame
  2312. DECLARE_INTERFACE_(IDockingWindowFrame, IOleWindow)
  2313. {
  2314. // *** IUnknown methods ***
  2315. STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  2316. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  2317. STDMETHOD_(ULONG,Release) (THIS) PURE;
  2318. // *** IOleWindow methods ***
  2319. STDMETHOD(GetWindow) (THIS_ HWND * lphwnd) PURE;
  2320. STDMETHOD(ContextSensitiveHelp) (THIS_ BOOL fEnterMode) PURE;
  2321. // *** IDockingWindowFrame methods ***
  2322. STDMETHOD(AddToolbar) (THIS_ IUnknown* punkSrc, LPCWSTR pwszItem, DWORD dwAddFlags) PURE;
  2323. STDMETHOD(RemoveToolbar) (THIS_ IUnknown* punkSrc, DWORD dwRemoveFlags) PURE;
  2324. STDMETHOD(FindToolbar) (THIS_ LPCWSTR pwszItem, REFIID riid, LPVOID* ppvObj) PURE;
  2325. };
  2326. //-------------------------------------------------------------------------
  2327. //
  2328. // IDockingWindow interface
  2329. //
  2330. // An object (docking window) implements this interface so the site can
  2331. // communicate with it. An example of a docking window is a toolbar.
  2332. //
  2333. // [Member functions]
  2334. //
  2335. // IDockingWindow::ShowDW(fShow)
  2336. // Shows or hides the docking window.
  2337. //
  2338. // IDockingWindow::CloseDW(dwReserved)
  2339. // Closes the docking window. dwReserved must be 0.
  2340. //
  2341. // IDockingWindow::ResizeBorderDW(prcBorder, punkToolbarSite, fReserved)
  2342. // Resizes the docking window's border to *prcBorder. fReserved must
  2343. // be 0.
  2344. // IObjectWithSite::SetSite(punkSite)
  2345. // IDockingWindow usually paired with IObjectWithSite.
  2346. // Provides the IUnknown pointer of the site to the docking window.
  2347. //
  2348. //
  2349. //-------------------------------------------------------------------------
  2350. #undef INTERFACE
  2351. #define INTERFACE IDockingWindow
  2352. DECLARE_INTERFACE_(IDockingWindow, IOleWindow)
  2353. {
  2354. // *** IUnknown methods ***
  2355. STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  2356. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  2357. STDMETHOD_(ULONG,Release) (THIS) PURE;
  2358. // *** IOleWindow methods ***
  2359. STDMETHOD(GetWindow) (THIS_ HWND * lphwnd) PURE;
  2360. STDMETHOD(ContextSensitiveHelp) (THIS_ BOOL fEnterMode) PURE;
  2361. // *** IDockingWindow methods ***
  2362. STDMETHOD(ShowDW) (THIS_ BOOL fShow) PURE;
  2363. STDMETHOD(CloseDW) (THIS_ DWORD dwReserved) PURE;
  2364. STDMETHOD(ResizeBorderDW) (THIS_ LPCRECT prcBorder,
  2365. IUnknown* punkToolbarSite,
  2366. BOOL fReserved) PURE;
  2367. };
  2368. //-------------------------------------------------------------------------
  2369. //
  2370. // IDeskBand interface
  2371. //
  2372. //
  2373. // [Member functions]
  2374. //
  2375. // IDeskBand::GetBandInfo(dwBandID, dwViewMode, pdbi)
  2376. // Returns info on the given band in *pdbi, according to the mask
  2377. // field in the DESKBANDINFO structure and the given viewmode.
  2378. //
  2379. //-------------------------------------------------------------------------
  2380. // Mask values for DESKBANDINFO
  2381. #define DBIM_MINSIZE 0x0001
  2382. #define DBIM_MAXSIZE 0x0002
  2383. #define DBIM_INTEGRAL 0x0004
  2384. #define DBIM_ACTUAL 0x0008
  2385. #define DBIM_TITLE 0x0010
  2386. #define DBIM_MODEFLAGS 0x0020
  2387. #define DBIM_BKCOLOR 0x0040
  2388. typedef struct {
  2389. DWORD dwMask;
  2390. POINTL ptMinSize;
  2391. POINTL ptMaxSize;
  2392. POINTL ptIntegral;
  2393. POINTL ptActual;
  2394. WCHAR wszTitle[256];
  2395. DWORD dwModeFlags;
  2396. COLORREF crBkgnd;
  2397. } DESKBANDINFO;
  2398. // DESKBANDINFO dwModeFlags values
  2399. #define DBIMF_NORMAL 0x0000
  2400. #define DBIMF_VARIABLEHEIGHT 0x0008
  2401. #define DBIMF_DEBOSSED 0x0020
  2402. #define DBIMF_BKCOLOR 0x0040
  2403. // GetBandInfo view mode values
  2404. #define DBIF_VIEWMODE_NORMAL 0x0000
  2405. #define DBIF_VIEWMODE_VERTICAL 0x0001
  2406. #define DBIF_VIEWMODE_FLOATING 0x0002
  2407. #define DBIF_VIEWMODE_TRANSPARENT 0x0004
  2408. #undef INTERFACE
  2409. #define INTERFACE IDeskBand
  2410. DECLARE_INTERFACE_(IDeskBand, IDockingWindow)
  2411. {
  2412. // *** IUnknown methods ***
  2413. STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  2414. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  2415. STDMETHOD_(ULONG,Release) (THIS) PURE;
  2416. // *** IOleWindow methods ***
  2417. STDMETHOD(GetWindow) (THIS_ HWND * lphwnd) PURE;
  2418. STDMETHOD(ContextSensitiveHelp) (THIS_ BOOL fEnterMode) PURE;
  2419. // *** IDockingWindow methods ***
  2420. STDMETHOD(ShowDW) (THIS_ BOOL fShow) PURE;
  2421. STDMETHOD(CloseDW) (THIS_ DWORD dwReserved) PURE;
  2422. STDMETHOD(ResizeBorderDW) (THIS_ LPCRECT prcBorder,
  2423. IUnknown* punkToolbarSite,
  2424. BOOL fReserved) PURE;
  2425. // *** IDeskBand methods ***
  2426. STDMETHOD(GetBandInfo) (THIS_ DWORD dwBandID, DWORD dwViewMode,
  2427. DESKBANDINFO* pdbi) PURE;
  2428. };
  2429. // Command Target IDs
  2430. enum {
  2431. DBID_BANDINFOCHANGED = 0,
  2432. //
  2433. DBID_SHOWONLY = 1,
  2434. DBID_MAXIMIZEBAND, // Maximize the specified band (VT_UI4 == dwID)
  2435. };
  2436. #if (_WIN32_IE >= 0x400)
  2437. //
  2438. // We need to make sure that WININET.H is included before this interface is
  2439. // used because the COMPONENT structure uses INTERNET_MAX_URL_LENGTH
  2440. //
  2441. #ifdef _WININET_
  2442. //
  2443. // Flags and structures used by IActiveDesktop
  2444. //
  2445. typedef struct _tagWALLPAPEROPT
  2446. {
  2447. DWORD dwSize; // size of this Structure.
  2448. DWORD dwStyle; // WPSTYLE_* mentioned above
  2449. }
  2450. WALLPAPEROPT;
  2451. typedef WALLPAPEROPT *LPWALLPAPEROPT;
  2452. typedef const WALLPAPEROPT *LPCWALLPAPEROPT;
  2453. typedef struct _tagCOMPONENTSOPT
  2454. {
  2455. DWORD dwSize; //Size of this structure
  2456. BOOL fEnableComponents; //Enable components?
  2457. BOOL fActiveDesktop; // Active desktop enabled ?
  2458. }
  2459. COMPONENTSOPT;
  2460. typedef COMPONENTSOPT *LPCOMPONENTSOPT;
  2461. typedef const COMPONENTSOPT *LPCCOMPONENTSOPT;
  2462. typedef struct _tagCOMPPOS
  2463. {
  2464. DWORD dwSize; //Size of this structure
  2465. int iLeft; //Left of top-left corner in screen co-ordinates.
  2466. int iTop; //Top of top-left corner in screen co-ordinates.
  2467. DWORD dwWidth; // Width in pixels.
  2468. DWORD dwHeight; // Height in pixels.
  2469. int izIndex; // Indicates the Z-order of the component.
  2470. BOOL fCanResize; // Is the component resizeable?
  2471. BOOL fCanResizeX; // Resizeable in X-direction?
  2472. BOOL fCanResizeY; // Resizeable in Y-direction?
  2473. int iPreferredLeftPercent; //Left of top-left corner as percent of screen width
  2474. int iPreferredTopPercent; //Top of top-left corner as percent of screen height
  2475. }
  2476. COMPPOS;
  2477. typedef COMPPOS *LPCOMPPOS;
  2478. typedef const COMPPOS *LPCCOMPPOS;
  2479. #define COMPONENT_TOP (0x7fffffff) // izOrder value meaning component is at the top
  2480. // iCompType values
  2481. #define COMP_TYPE_HTMLDOC 0
  2482. #define COMP_TYPE_PICTURE 1
  2483. #define COMP_TYPE_WEBSITE 2
  2484. #define COMP_TYPE_CONTROL 3
  2485. #define COMP_TYPE_CFHTML 4
  2486. #define COMP_TYPE_MAX 4
  2487. typedef struct _tagCOMPONENT
  2488. {
  2489. DWORD dwSize; //Size of this structure
  2490. DWORD dwID; //Reserved: Set it always to zero.
  2491. int iComponentType; //One of COMP_TYPE_*
  2492. BOOL fChecked; // Is this component enabled?
  2493. BOOL fDirty; // Had the component been modified and not yet saved to disk?
  2494. BOOL fNoScroll; // Is the component scrollable?
  2495. COMPPOS cpPos; // Width, height etc.,
  2496. WCHAR wszFriendlyName[MAX_PATH]; // Friendly name of component.
  2497. WCHAR wszSource[INTERNET_MAX_URL_LENGTH]; //URL of the component.
  2498. WCHAR wszSubscribedURL[INTERNET_MAX_URL_LENGTH]; //Subscrined URL
  2499. }
  2500. COMPONENT;
  2501. typedef COMPONENT *LPCOMPONENT;
  2502. typedef const COMPONENT *LPCCOMPONENT;
  2503. ////////////////////////////////////////////
  2504. // Flags for IActiveDesktop::ApplyChanges()
  2505. #define AD_APPLY_SAVE 0x00000001
  2506. #define AD_APPLY_HTMLGEN 0x00000002
  2507. #define AD_APPLY_REFRESH 0x00000004
  2508. #define AD_APPLY_ALL (AD_APPLY_SAVE | AD_APPLY_HTMLGEN | AD_APPLY_REFRESH)
  2509. #define AD_APPLY_FORCE 0x00000008
  2510. #define AD_APPLY_BUFFERED_REFRESH 0x00000010
  2511. ////////////////////////////////////////////
  2512. // Flags for IActiveDesktop::GetWallpaperOptions()
  2513. // IActiveDesktop::SetWallpaperOptions()
  2514. #define WPSTYLE_CENTER 0
  2515. #define WPSTYLE_TILE 1
  2516. #define WPSTYLE_STRETCH 2
  2517. #define WPSTYLE_MAX 3
  2518. ////////////////////////////////////////////
  2519. // Flags for IActiveDesktop::ModifyComponent()
  2520. #define COMP_ELEM_TYPE 0x00000001
  2521. #define COMP_ELEM_CHECKED 0x00000002
  2522. #define COMP_ELEM_DIRTY 0x00000004
  2523. #define COMP_ELEM_NOSCROLL 0x00000008
  2524. #define COMP_ELEM_POS_LEFT 0x00000010
  2525. #define COMP_ELEM_POS_TOP 0x00000020
  2526. #define COMP_ELEM_SIZE_WIDTH 0x00000040
  2527. #define COMP_ELEM_SIZE_HEIGHT 0x00000080
  2528. #define COMP_ELEM_POS_ZINDEX 0x00000100
  2529. #define COMP_ELEM_SOURCE 0x00000200
  2530. #define COMP_ELEM_FRIENDLYNAME 0x00000400
  2531. #define COMP_ELEM_SUBSCRIBEDURL 0x00000800
  2532. #define COMP_ELEM_ALL (COMP_ELEM_TYPE | COMP_ELEM_CHECKED | COMP_ELEM_DIRTY | \
  2533. COMP_ELEM_NOSCROLL | COMP_ELEM_POS_LEFT | COMP_ELEM_SIZE_WIDTH \
  2534. COMP_ELEM_SIZE_HEIGHT | COMP_ELEM_POS_ZINDEX | COMP_ELEM_SOURCE \
  2535. COMP_ELEM_FRIENDLYNAME )
  2536. ////////////////////////////////////////////
  2537. // Flags for IActiveDesktop::AddDesktopItemWithUI()
  2538. typedef enum tagDTI_ADTIWUI
  2539. {
  2540. DTI_ADDUI_DEFAULT = 0x00000000,
  2541. DTI_ADDUI_DISPSUBWIZARD = 0x00000001,
  2542. };
  2543. ////////////////////////////////////////////
  2544. // Flags for IActiveDesktop::AddUrl()
  2545. #define ADDURL_SILENT 0X0001
  2546. //
  2547. // Interface for manipulating the Active Desktop.
  2548. //
  2549. #undef INTERFACE
  2550. #define INTERFACE IActiveDesktop
  2551. DECLARE_INTERFACE_( IActiveDesktop, IUnknown )
  2552. {
  2553. // IUnknown methods
  2554. STDMETHOD (QueryInterface)(THIS_ REFIID riid, void ** ppv) PURE;
  2555. STDMETHOD_(ULONG, AddRef) ( THIS ) PURE;
  2556. STDMETHOD_(ULONG, Release) ( THIS ) PURE;
  2557. // IActiveDesktop methods
  2558. STDMETHOD (ApplyChanges)(THIS_ DWORD dwFlags) PURE;
  2559. STDMETHOD (GetWallpaper)(THIS_ LPWSTR pwszWallpaper, UINT cchWallpaper, DWORD dwReserved) PURE;
  2560. STDMETHOD (SetWallpaper)(THIS_ LPCWSTR pwszWallpaper, DWORD dwReserved) PURE;
  2561. STDMETHOD (GetWallpaperOptions)(THIS_ LPWALLPAPEROPT pwpo, DWORD dwReserved) PURE;
  2562. STDMETHOD (SetWallpaperOptions)(THIS_ LPCWALLPAPEROPT pwpo, DWORD dwReserved) PURE;
  2563. STDMETHOD (GetPattern)(THIS_ LPWSTR pwszPattern, UINT cchPattern, DWORD dwReserved) PURE;
  2564. STDMETHOD (SetPattern)(THIS_ LPCWSTR pwszPattern, DWORD dwReserved) PURE;
  2565. STDMETHOD (GetDesktopItemOptions)(THIS_ LPCOMPONENTSOPT pco, DWORD dwReserved) PURE;
  2566. STDMETHOD (SetDesktopItemOptions)(THIS_ LPCCOMPONENTSOPT pco, DWORD dwReserved) PURE;
  2567. STDMETHOD (AddDesktopItem)(THIS_ LPCCOMPONENT pcomp, DWORD dwReserved) PURE;
  2568. STDMETHOD (AddDesktopItemWithUI)(THIS_ HWND hwnd, LPCOMPONENT pcomp, DWORD dwReserved) PURE;
  2569. STDMETHOD (ModifyDesktopItem)(THIS_ LPCCOMPONENT pcomp, DWORD dwFlags) PURE;
  2570. STDMETHOD (RemoveDesktopItem)(THIS_ LPCCOMPONENT pcomp, DWORD dwReserved) PURE;
  2571. STDMETHOD (GetDesktopItemCount)(THIS_ LPINT lpiCount, DWORD dwReserved) PURE;
  2572. STDMETHOD (GetDesktopItem)(THIS_ int nComponent, LPCOMPONENT pcomp, DWORD dwReserved) PURE;
  2573. STDMETHOD (GetDesktopItemByID)(THIS_ DWORD dwID, LPCOMPONENT pcomp, DWORD dwReserved) PURE;
  2574. STDMETHOD (GenerateDesktopItemHtml)(THIS_ LPCWSTR pwszFileName, LPCOMPONENT pcomp, DWORD dwReserved) PURE;
  2575. STDMETHOD (AddUrl)(THIS_ HWND hwnd, LPCWSTR pszSource, LPCOMPONENT pcomp, DWORD dwFlags) PURE;
  2576. STDMETHOD (GetDesktopItemBySource)(THIS_ LPCWSTR pwszSource, LPCOMPONENT pcomp, DWORD dwReserved) PURE;
  2577. };
  2578. typedef IActiveDesktop * LPACTIVEDESKTOP;
  2579. #endif // _WININET_
  2580. #endif // _WIN32_IE
  2581. //==========================================================================
  2582. // Clipboard format which may be supported by IDataObject from system
  2583. // defined shell folders (such as directories, network, ...).
  2584. //==========================================================================
  2585. #define CFSTR_SHELLIDLIST TEXT("Shell IDList Array") // CF_IDLIST
  2586. #define CFSTR_SHELLIDLISTOFFSET TEXT("Shell Object Offsets") // CF_OBJECTPOSITIONS
  2587. #define CFSTR_NETRESOURCES TEXT("Net Resource") // CF_NETRESOURCE
  2588. #define CFSTR_FILEDESCRIPTORA TEXT("FileGroupDescriptor") // CF_FILEGROUPDESCRIPTORA
  2589. #define CFSTR_FILEDESCRIPTORW TEXT("FileGroupDescriptorW") // CF_FILEGROUPDESCRIPTORW
  2590. #define CFSTR_FILECONTENTS TEXT("FileContents") // CF_FILECONTENTS
  2591. #define CFSTR_FILENAMEA TEXT("FileName") // CF_FILENAMEA
  2592. #define CFSTR_FILENAMEW TEXT("FileNameW") // CF_FILENAMEW
  2593. #define CFSTR_PRINTERGROUP TEXT("PrinterFriendlyName") // CF_PRINTERS
  2594. #define CFSTR_FILENAMEMAPA TEXT("FileNameMap") // CF_FILENAMEMAPA
  2595. #define CFSTR_FILENAMEMAPW TEXT("FileNameMapW") // CF_FILENAMEMAPW
  2596. #define CFSTR_SHELLURL TEXT("UniformResourceLocator")
  2597. #define CFSTR_PREFERREDDROPEFFECT TEXT("Preferred DropEffect")
  2598. #define CFSTR_PERFORMEDDROPEFFECT TEXT("Performed DropEffect")
  2599. #define CFSTR_PASTESUCCEEDED TEXT("Paste Succeeded")
  2600. #define CFSTR_INDRAGLOOP TEXT("InShellDragLoop")
  2601. #ifdef UNICODE
  2602. #define CFSTR_FILEDESCRIPTOR CFSTR_FILEDESCRIPTORW
  2603. #define CFSTR_FILENAME CFSTR_FILENAMEW
  2604. #define CFSTR_FILENAMEMAP CFSTR_FILENAMEMAPW
  2605. #else
  2606. #define CFSTR_FILEDESCRIPTOR CFSTR_FILEDESCRIPTORA
  2607. #define CFSTR_FILENAME CFSTR_FILENAMEA
  2608. #define CFSTR_FILENAMEMAP CFSTR_FILENAMEMAPA
  2609. #endif
  2610. //
  2611. // CF_OBJECTPOSITIONS
  2612. //
  2613. //
  2614. #define DVASPECT_SHORTNAME 2 // use for CF_HDROP to get short name version
  2615. //
  2616. // format of CF_NETRESOURCE
  2617. //
  2618. typedef struct _NRESARRAY { // anr
  2619. UINT cItems;
  2620. NETRESOURCE nr[1];
  2621. } NRESARRAY, * LPNRESARRAY;
  2622. //
  2623. // format of CF_IDLIST
  2624. //
  2625. typedef struct _IDA {
  2626. UINT cidl; // number of relative IDList
  2627. UINT aoffset[1]; // [0]: folder IDList, [1]-[cidl]: item IDList
  2628. } CIDA, * LPIDA;
  2629. //
  2630. // FILEDESCRIPTOR.dwFlags field indicate which fields are to be used
  2631. //
  2632. typedef enum {
  2633. FD_CLSID = 0x0001,
  2634. FD_SIZEPOINT = 0x0002,
  2635. FD_ATTRIBUTES = 0x0004,
  2636. FD_CREATETIME = 0x0008,
  2637. FD_ACCESSTIME = 0x0010,
  2638. FD_WRITESTIME = 0x0020,
  2639. FD_FILESIZE = 0x0040,
  2640. FD_LINKUI = 0x8000, // 'link' UI is prefered
  2641. } FD_FLAGS;
  2642. typedef struct _FILEDESCRIPTORA { // fod
  2643. DWORD dwFlags;
  2644. CLSID clsid;
  2645. SIZEL sizel;
  2646. POINTL pointl;
  2647. DWORD dwFileAttributes;
  2648. FILETIME ftCreationTime;
  2649. FILETIME ftLastAccessTime;
  2650. FILETIME ftLastWriteTime;
  2651. DWORD nFileSizeHigh;
  2652. DWORD nFileSizeLow;
  2653. CHAR cFileName[ MAX_PATH ];
  2654. } FILEDESCRIPTORA, *LPFILEDESCRIPTORA;
  2655. typedef struct _FILEDESCRIPTORW { // fod
  2656. DWORD dwFlags;
  2657. CLSID clsid;
  2658. SIZEL sizel;
  2659. POINTL pointl;
  2660. DWORD dwFileAttributes;
  2661. FILETIME ftCreationTime;
  2662. FILETIME ftLastAccessTime;
  2663. FILETIME ftLastWriteTime;
  2664. DWORD nFileSizeHigh;
  2665. DWORD nFileSizeLow;
  2666. WCHAR cFileName[ MAX_PATH ];
  2667. } FILEDESCRIPTORW, *LPFILEDESCRIPTORW;
  2668. #ifdef UNICODE
  2669. #define FILEDESCRIPTOR FILEDESCRIPTORW
  2670. #define LPFILEDESCRIPTOR LPFILEDESCRIPTORW
  2671. #else
  2672. #define FILEDESCRIPTOR FILEDESCRIPTORA
  2673. #define LPFILEDESCRIPTOR LPFILEDESCRIPTORA
  2674. #endif
  2675. //
  2676. // format of CF_FILEGROUPDESCRIPTOR
  2677. //
  2678. typedef struct _FILEGROUPDESCRIPTORA { // fgd
  2679. UINT cItems;
  2680. FILEDESCRIPTORA fgd[1];
  2681. } FILEGROUPDESCRIPTORA, * LPFILEGROUPDESCRIPTORA;
  2682. typedef struct _FILEGROUPDESCRIPTORW { // fgd
  2683. UINT cItems;
  2684. FILEDESCRIPTORW fgd[1];
  2685. } FILEGROUPDESCRIPTORW, * LPFILEGROUPDESCRIPTORW;
  2686. #ifdef UNICODE
  2687. #define FILEGROUPDESCRIPTOR FILEGROUPDESCRIPTORW
  2688. #define LPFILEGROUPDESCRIPTOR LPFILEGROUPDESCRIPTORW
  2689. #else
  2690. #define FILEGROUPDESCRIPTOR FILEGROUPDESCRIPTORA
  2691. #define LPFILEGROUPDESCRIPTOR LPFILEGROUPDESCRIPTORA
  2692. #endif
  2693. //
  2694. // format of CF_HDROP and CF_PRINTERS, in the HDROP case the data that follows
  2695. // is a double null terinated list of file names, for printers they are printer
  2696. // friendly names
  2697. //
  2698. typedef struct _DROPFILES {
  2699. DWORD pFiles; // offset of file list
  2700. POINT pt; // drop point (client coords)
  2701. BOOL fNC; // is it on NonClient area
  2702. // and pt is in screen coords
  2703. BOOL fWide; // WIDE character switch
  2704. } DROPFILES, FAR * LPDROPFILES;
  2705. //====== File System Notification APIs ===============================
  2706. //
  2707. //
  2708. // File System Notification flags
  2709. //
  2710. #define SHCNE_RENAMEITEM 0x00000001L
  2711. #define SHCNE_CREATE 0x00000002L
  2712. #define SHCNE_DELETE 0x00000004L
  2713. #define SHCNE_MKDIR 0x00000008L
  2714. #define SHCNE_RMDIR 0x00000010L
  2715. #define SHCNE_MEDIAINSERTED 0x00000020L
  2716. #define SHCNE_MEDIAREMOVED 0x00000040L
  2717. #define SHCNE_DRIVEREMOVED 0x00000080L
  2718. #define SHCNE_DRIVEADD 0x00000100L
  2719. #define SHCNE_NETSHARE 0x00000200L
  2720. #define SHCNE_NETUNSHARE 0x00000400L
  2721. #define SHCNE_ATTRIBUTES 0x00000800L
  2722. #define SHCNE_UPDATEDIR 0x00001000L
  2723. #define SHCNE_UPDATEITEM 0x00002000L
  2724. #define SHCNE_SERVERDISCONNECT 0x00004000L
  2725. #define SHCNE_UPDATEIMAGE 0x00008000L
  2726. #define SHCNE_DRIVEADDGUI 0x00010000L
  2727. #define SHCNE_RENAMEFOLDER 0x00020000L
  2728. #define SHCNE_FREESPACE 0x00040000L
  2729. #if (_WIN32_IE >= 0x0400)
  2730. #define SHCNE_EXTENDED_EVENT 0x04000000L
  2731. #endif // _WIN32_IE >= 0x0400
  2732. #define SHCNE_ASSOCCHANGED 0x08000000L
  2733. #define SHCNE_DISKEVENTS 0x0002381FL
  2734. #define SHCNE_GLOBALEVENTS 0x0C0581E0L // Events that dont match pidls first
  2735. #define SHCNE_ALLEVENTS 0x7FFFFFFFL
  2736. #define SHCNE_INTERRUPT 0x80000000L // The presence of this flag indicates
  2737. // that the event was generated by an
  2738. // interrupt. It is stripped out before
  2739. // the clients of SHCNNotify_ see it.
  2740. #if (_WIN32_IE >= 0x0400)
  2741. #define SHCNEE_ORDERCHANGED 0x00000002L // dwItem2 is the pidl of the changed folder
  2742. #endif
  2743. // Flags
  2744. // uFlags & SHCNF_TYPE is an ID which indicates what dwItem1 and dwItem2 mean
  2745. #define SHCNF_IDLIST 0x0000 // LPITEMIDLIST
  2746. #define SHCNF_PATHA 0x0001 // path name
  2747. #define SHCNF_PRINTERA 0x0002 // printer friendly name
  2748. #define SHCNF_DWORD 0x0003 // DWORD
  2749. #define SHCNF_PATHW 0x0005 // path name
  2750. #define SHCNF_PRINTERW 0x0006 // printer friendly name
  2751. #define SHCNF_TYPE 0x00FF
  2752. #define SHCNF_FLUSH 0x1000
  2753. #define SHCNF_FLUSHNOWAIT 0x2000
  2754. #ifdef UNICODE
  2755. #define SHCNF_PATH SHCNF_PATHW
  2756. #define SHCNF_PRINTER SHCNF_PRINTERW
  2757. #else
  2758. #define SHCNF_PATH SHCNF_PATHA
  2759. #define SHCNF_PRINTER SHCNF_PRINTERA
  2760. #endif
  2761. //
  2762. // APIs
  2763. //
  2764. WINSHELLAPI void WINAPI SHChangeNotify(LONG wEventId, UINT uFlags,
  2765. LPCVOID dwItem1, LPCVOID dwItem2);
  2766. //
  2767. // IShellChangeNotify
  2768. //
  2769. #undef INTERFACE
  2770. #define INTERFACE IShellChangeNotify
  2771. DECLARE_INTERFACE_(IShellChangeNotify, IUnknown)
  2772. {
  2773. // *** IUnknown methods ***
  2774. STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  2775. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  2776. STDMETHOD_(ULONG,Release) (THIS) PURE;
  2777. // *** IShellChangeNotify methods ***
  2778. STDMETHOD(OnChange) (THIS_ LONG lEvent, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2) PURE;
  2779. } ;
  2780. //
  2781. // IQueryInfo
  2782. //
  2783. #undef INTERFACE
  2784. #define INTERFACE IQueryInfo
  2785. DECLARE_INTERFACE_(IQueryInfo, IUnknown)
  2786. {
  2787. // *** IUnknown methods ***
  2788. STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  2789. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  2790. STDMETHOD_(ULONG,Release) (THIS) PURE;
  2791. // *** IQueryInfo methods ***
  2792. STDMETHOD(GetInfoTip)(THIS_ DWORD dwFlags, WCHAR **ppwszTip) PURE;
  2793. STDMETHOD(GetInfoFlags)(THIS_ DWORD *pdwFlags) PURE;
  2794. } ;
  2795. #define QIF_CACHED 0x00000001
  2796. #define QIF_DONTEXPANDFOLDER 0x00000002
  2797. //
  2798. // SHAddToRecentDocs
  2799. //
  2800. #define SHARD_PIDL 0x00000001L
  2801. #define SHARD_PATHA 0x00000002L
  2802. #define SHARD_PATHW 0x00000003L
  2803. #ifdef UNICODE
  2804. #define SHARD_PATH SHARD_PATHW
  2805. #else
  2806. #define SHARD_PATH SHARD_PATHA
  2807. #endif
  2808. WINSHELLAPI void WINAPI SHAddToRecentDocs(UINT uFlags, LPCVOID pv);
  2809. WINSHELLAPI HRESULT WINAPI SHGetInstanceExplorer(IUnknown **ppunk);
  2810. //
  2811. // SHGetDataFromIDListA/W
  2812. //
  2813. #define SHGDFIL_FINDDATA 1
  2814. #define SHGDFIL_NETRESOURCE 2
  2815. #define SHGDFIL_DESCRIPTIONID 3
  2816. #define SHDID_ROOT_REGITEM 1
  2817. #define SHDID_FS_FILE 2
  2818. #define SHDID_FS_DIRECTORY 3
  2819. #define SHDID_FS_OTHER 4
  2820. #define SHDID_COMPUTER_DRIVE35 5
  2821. #define SHDID_COMPUTER_DRIVE525 6
  2822. #define SHDID_COMPUTER_REMOVABLE 7
  2823. #define SHDID_COMPUTER_FIXED 8
  2824. #define SHDID_COMPUTER_NETDRIVE 9
  2825. #define SHDID_COMPUTER_CDROM 10
  2826. #define SHDID_COMPUTER_RAMDISK 11
  2827. #define SHDID_COMPUTER_OTHER 12
  2828. #define SHDID_NET_DOMAIN 13
  2829. #define SHDID_NET_SERVER 14
  2830. #define SHDID_NET_SHARE 15
  2831. #define SHDID_NET_RESTOFNET 16
  2832. #define SHDID_NET_OTHER 17
  2833. typedef struct _SHDESCRIPTIONID {
  2834. DWORD dwDescriptionId;
  2835. CLSID clsid;
  2836. } SHDESCRIPTIONID, *LPSHDESCRIPTIONID;
  2837. WINSHELLAPI HRESULT WINAPI SHGetDataFromIDListA(LPSHELLFOLDER psf, LPCITEMIDLIST pidl,
  2838. int nFormat, PVOID pv, int cb);
  2839. WINSHELLAPI HRESULT WINAPI SHGetDataFromIDListW(LPSHELLFOLDER psf, LPCITEMIDLIST pidl,
  2840. int nFormat, PVOID pv, int cb);
  2841. #ifdef UNICODE
  2842. #define SHGetDataFromIDList SHGetDataFromIDListW
  2843. #else
  2844. #define SHGetDataFromIDList SHGetDataFromIDListA
  2845. #endif
  2846. //===========================================================================
  2847. //
  2848. // PROPIDs for Internet Shortcuts (FMTID_Intshcut) to be used with
  2849. // IPropertySetStorage/IPropertyStorage
  2850. //
  2851. // The known property ids and their variant types are:
  2852. // PID_IS_URL [VT_LPWSTR] URL
  2853. // PID_IS_NAME [VT_LPWSTR] Name of the internet shortcut
  2854. // PID_IS_WORKINGDIR [VT_LPWSTR] Working directory for the shortcut
  2855. // PID_IS_HOTKEY [VT_UI2] Hotkey for the shortcut
  2856. // PID_IS_SHOWCMD [VT_I4] Show command for shortcut
  2857. // PID_IS_ICONINDEX [VT_I4] Index into file that has icon
  2858. // PID_IS_ICONFILE [VT_LPWSTR] File that has the icon
  2859. // PID_IS_WHATSNEW [VT_LPWSTR] What's New text
  2860. // PID_IS_AUTHOR [VT_LPWSTR] Author
  2861. // PID_IS_DESCRIPTION [VT_LPWSTR] Description text of site
  2862. // PID_IS_COMMENT [VT_LPWSTR] User annotated comment
  2863. //
  2864. #define PID_IS_URL 2
  2865. #define PID_IS_NAME 4
  2866. #define PID_IS_WORKINGDIR 5
  2867. #define PID_IS_HOTKEY 6
  2868. #define PID_IS_SHOWCMD 7
  2869. #define PID_IS_ICONINDEX 8
  2870. #define PID_IS_ICONFILE 9
  2871. #define PID_IS_WHATSNEW 10
  2872. #define PID_IS_AUTHOR 11
  2873. #define PID_IS_DESCRIPTION 12
  2874. #define PID_IS_COMMENT 13
  2875. //
  2876. // PROPIDs for Internet Sites (FMTID_InternetSite) to be used with
  2877. // IPropertySetStorage/IPropertyStorage
  2878. //
  2879. // The known property ids and their variant types are:
  2880. // PID_INTSITE_WHATSNEW [VT_LPWSTR] What's New text
  2881. // PID_INTSITE_AUTHOR [VT_LPWSTR] Author
  2882. // PID_INTSITE_LASTVISIT [VT_FILETIME] Time site was last visited
  2883. // PID_INTSITE_LASTMOD [VT_FILETIME] Time site was last modified
  2884. // PID_INTSITE_VISITCOUNT [VT_UI4] Number of times user has visited
  2885. // PID_INTSITE_DESCRIPTION [VT_LPWSTR] Description text of site
  2886. // PID_INTSITE_COMMENT [VT_LPWSTR] User annotated comment
  2887. // PID_INTSITE_RECURSE [VT_UI4] Levels to recurse (0-3)
  2888. // PID_INTSITE_WATCH [VT_UI4] PIDISM_ flags
  2889. // PID_INTSITE_SUBSCRIPTION [VT_UI8] Subscription cookie
  2890. // PID_INTSITE_URL [VT_LPWSTR] URL
  2891. // PID_INTSITE_TITLE [VT_LPWSTR] Title
  2892. // PID_INTSITE_CODEPAGE [VT_UI4] Codepage of the document
  2893. // PID_INTSITE_TRACKING [VT_UI4] Tracking
  2894. //
  2895. #define PID_INTSITE_WHATSNEW 2
  2896. #define PID_INTSITE_AUTHOR 3
  2897. #define PID_INTSITE_LASTVISIT 4
  2898. #define PID_INTSITE_LASTMOD 5
  2899. #define PID_INTSITE_VISITCOUNT 6
  2900. #define PID_INTSITE_DESCRIPTION 7
  2901. #define PID_INTSITE_COMMENT 8
  2902. #define PID_INTSITE_FLAGS 9
  2903. #define PID_INTSITE_CONTENTLEN 10
  2904. #define PID_INTSITE_CONTENTCODE 11
  2905. #define PID_INTSITE_RECURSE 12
  2906. #define PID_INTSITE_WATCH 13
  2907. #define PID_INTSITE_SUBSCRIPTION 14
  2908. #define PID_INTSITE_URL 15
  2909. #define PID_INTSITE_TITLE 16
  2910. #define PID_INTSITE_CODEPAGE 18
  2911. #define PID_INTSITE_TRACKING 19
  2912. // Flags for PID_IS_FLAGS
  2913. #define PIDISF_RECENTLYCHANGED 0x00000001
  2914. #define PIDISF_CACHEDSTICKY 0x00000002
  2915. #define PIDISF_CACHEIMAGES 0x00000010
  2916. #define PIDISF_FOLLOWALLLINKS 0x00000020
  2917. // Values for PID_INTSITE_WATCH
  2918. #define PIDISM_GLOBAL 0 // Monitor based on global setting
  2919. #define PIDISM_WATCH 1 // User says watch
  2920. #define PIDISM_DONTWATCH 2 // User says don't watch
  2921. ////////////////////////////////////////////////////////////////////
  2922. //
  2923. // The shell keeps track of some per-user state to handle display
  2924. // options that is of major interest to ISVs.
  2925. // The key one requested right now is "DoubleClickInWebView".
  2926. typedef struct {
  2927. BOOL fShowAllObjects : 1;
  2928. BOOL fShowExtensions : 1;
  2929. BOOL fNoConfirmRecycle : 1;
  2930. BOOL fShowSysFiles : 1;
  2931. BOOL fShowCompColor : 1;
  2932. BOOL fDoubleClickInWebView : 1;
  2933. BOOL fDesktopHTML : 1;
  2934. BOOL fWin95Classic : 1;
  2935. BOOL fDontPrettyPath : 1;
  2936. BOOL fShowAttribCol : 1;
  2937. BOOL fMapNetDrvBtn : 1;
  2938. BOOL fShowInfoTip : 1;
  2939. BOOL fHideIcons : 1;
  2940. UINT fRestFlags : 3;
  2941. } SHELLFLAGSTATE, * LPSHELLFLAGSTATE;
  2942. #define SSF_SHOWALLOBJECTS 0x0001
  2943. #define SSF_SHOWEXTENSIONS 0x0002
  2944. #define SSF_SHOWCOMPCOLOR 0x0008
  2945. #define SSF_SHOWSYSFILES 0x0020
  2946. #define SSF_DOUBLECLICKINWEBVIEW 0x0080
  2947. #define SSF_SHOWATTRIBCOL 0x0100
  2948. #define SSF_DESKTOPHTML 0x0200
  2949. #define SSF_WIN95CLASSIC 0x0400
  2950. #define SSF_DONTPRETTYPATH 0x0800
  2951. #define SSF_SHOWINFOTIP 0x2000
  2952. #define SSF_MAPNETDRVBUTTON 0x1000
  2953. #define SSF_NOCONFIRMRECYCLE 0x8000
  2954. #define SSF_HIDEICONS 0x4000
  2955. // SHGetSettings(LPSHELLFLAGSTATE lpss, DWORD dwMask)
  2956. //
  2957. // Specify the bits you are interested in in dwMask and they will be
  2958. // filled out in the lpss structure.
  2959. //
  2960. // When these settings change, a WM_SETTINGCHANGE message is sent
  2961. // with the string lParam value of "ShellState".
  2962. //
  2963. void WINAPI SHGetSettings(LPSHELLFLAGSTATE lpsfs, DWORD dwMask);
  2964. #ifdef __urlmon_h__
  2965. // NOTE: urlmon.h must be included before shlobj.h to access this function.
  2966. //
  2967. // SoftwareUpdateMessageBox
  2968. //
  2969. // Provides a standard message box for the alerting the user that a software
  2970. // update is available or installed. No UI will be displayed if there is no
  2971. // update available or if the available update version is less than or equal
  2972. // to the Advertised update version.
  2973. //
  2974. // hWnd - [in] Handle of owner window
  2975. // szDistUnit - [in] Unique identifier string for a code distribution unit. For
  2976. // ActiveX controls and Active Setup installed components, this
  2977. // is typically a GUID string.
  2978. // dwFlags - [in] Must be 0.
  2979. // psdi - [in,out] Pointer to SOFTDISTINFO ( see URLMon.h ). May be NULL.
  2980. // cbSize should be initialized
  2981. // by the caller to sizeof(SOFTDISTINFO), dwReserved should be set to 0.
  2982. //
  2983. // RETURNS:
  2984. //
  2985. // IDNO - The user chose cancel. If *pbRemind is FALSE, the caller should save the
  2986. // update version from the SOFTDISTINFO and pass it in as the Advertised
  2987. // version in future calls.
  2988. //
  2989. // IDYES - The user has selected Update Now/About Update. The caller should navigate to
  2990. // the SOFTDISTINFO's pszHREF to initiate the install or learn about it.
  2991. // The caller should save the update version from the SOFTDISTINFO and pass
  2992. // it in as the Advertised version in future calls.
  2993. //
  2994. // IDIGNORE - There is no pending software update. Note: There is
  2995. // no Ignore button in the standard UI. This occurs if the available
  2996. // version is less than the installed version or is not present or if the
  2997. // Advertised version is greater than or equal to the update version.
  2998. //
  2999. // IDABORT - An error occured. Call GetSoftwareUpdateInfo() for a more specific HRESULT.
  3000. // Note: There is no Abort button in the standard UI.
  3001. SHDOCAPI_(DWORD) SoftwareUpdateMessageBox( HWND hWnd,
  3002. LPCWSTR szDistUnit,
  3003. DWORD dwFlags,
  3004. LPSOFTDISTINFO psdi );
  3005. #endif // if __urlmon_h__
  3006. #ifdef __cplusplus
  3007. }
  3008. #endif /* __cplusplus */
  3009. #ifndef RC_INVOKED
  3010. #pragma pack()
  3011. #endif /* !RC_INVOKED */
  3012. #endif // _SHLOBJ_H_