home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 2000 May / PCP163A.iso / Runimage / Cbuilder4 / Source / Vcl / SHLOBJ.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1999-01-26  |  130.8 KB  |  3,276 lines

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