using System; using System.Runtime.InteropServices; using System.Runtime.InteropServices.ComTypes; using Vanara.Extensions; using static Vanara.PInvoke.ComCtl32; using static Vanara.PInvoke.Ole32; namespace Vanara.PInvoke { public static partial class Shell32 { /// Used with method IBrowserFrameOptions::GetFrameOptions. /// These constants are defined in the Shobjidl.h file beginning in Windows Vista. // https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/ne-shobjidl_core-_browserframeoptions typedef enum // _BROWSERFRAMEOPTIONS { BFO_NONE, BFO_BROWSER_PERSIST_SETTINGS, BFO_RENAME_FOLDER_OPTIONS_TOINTERNET, BFO_BOTH_OPTIONS, // BIF_PREFER_INTERNET_SHORTCUT, BFO_BROWSE_NO_IN_NEW_PROCESS, BFO_ENABLE_HYPERLINK_TRACKING, BFO_USE_IE_OFFLINE_SUPPORT, // BFO_SUBSTITUE_INTERNET_START_PAGE, BFO_USE_IE_LOGOBANDING, BFO_ADD_IE_TOCAPTIONBAR, BFO_USE_DIALUP_REF, BFO_USE_IE_TOOLBAR, // BFO_NO_PARENT_FOLDER_SUPPORT, BFO_NO_REOPEN_NEXT_RESTART, BFO_GO_HOME_PAGE, BFO_PREFER_IEPROCESS, BFO_SHOW_NAVIGATION_CANCELLED, // BFO_USE_IE_STATUSBAR, BFO_QUERY_ALL } ; [PInvokeData("shobjidl_core.h", MSDNShortId = "NE:shobjidl_core._BROWSERFRAMEOPTIONS")] [Flags] public enum BROWSERFRAMEOPTIONS : uint { /// Do nothing. BFO_NONE = 0, /// Use the browser stream for this item. (Same window position as IE browser windows.) BFO_BROWSER_PERSIST_SETTINGS = 0x1, /// Rename Folder Options to Internet Options in the Tools or View menu. BFO_RENAME_FOLDER_OPTIONS_TOINTERNET = 0x2, /// Keep both Folder Options and Internet Options in the Tools or View menu. BFO_BOTH_OPTIONS = 0x4, /// This namespace extension prefers a .url shortcut over a .lnk shortcut. BIF_PREFER_INTERNET_SHORTCUT = 0x8, /// Do not use "Browse in New Process" by invoking a shortcut. BFO_BROWSE_NO_IN_NEW_PROCESS = 0x10, /// Track display name to determine when hyperlinks should be tagged as previously used. BFO_ENABLE_HYPERLINK_TRACKING = 0x20, /// Use Internet Explorer's offline support. BFO_USE_IE_OFFLINE_SUPPORT = 0x40, /// Use Start Page support for this namespace extension. BFO_SUBSTITUE_INTERNET_START_PAGE = 0x80, /// Use the Brand block in the Toolbar. BFO_USE_IE_LOGOBANDING = 0x100, /// Append to display name in the caption bar. BFO_ADD_IE_TOCAPTIONBAR = 0x200, /// /// Reference the DialUp reference count while the browser is navigated to this location. This will also enable the ICW and /// Software update. /// BFO_USE_DIALUP_REF = 0x400, /// Use the Internet Explorer toolbar. BFO_USE_IE_TOOLBAR = 0x800, /// /// Disable navigation to parent folders. Used for the button that navigates to parent folder or the View.GoTo.ParentFolder feature. /// BFO_NO_PARENT_FOLDER_SUPPORT = 0x1000, /// /// Browser windows are not reopened after a reboot of the system, regardless of whether they were open before the reboot. Use /// the same behavior for the namespace extension. /// BFO_NO_REOPEN_NEXT_RESTART = 0x2000, /// Add Home Page to menu (Go). BFO_GO_HOME_PAGE = 0x4000, /// Prefer use of Iexplore.exe over Explorer.exe. BFO_PREFER_IEPROCESS = 0x8000, /// If navigation is terminated, show the Action Canceled HTML page. BFO_SHOW_NAVIGATION_CANCELLED = 0x10000, /// Use the persisted Internet Explorer status bar settings. BFO_USE_IE_STATUSBAR = 0x20000, /// Return all values. BFO_QUERY_ALL = 0xffffffff, } /// Flags specifying where the toolbar buttons should go. [PInvokeData("shobjidl.h")] [Flags] public enum FCT : uint { /// /// Merge the toolbar items instead of replacing all of the buttons with those provided by the view. This is the recommended choice. /// FCT_MERGE = 0x0001, /// Not implemented. FCT_CONFIGABLE = 0x0002, /// Add at the right side of the toolbar. FCT_ADDTOEND = 0x0004, } /// /// A value that indicates the frame control to show or hide. One of the following values as defined in Shobjidl.h or -1 for /// fullscreen/kiosk mode. /// [PInvokeData("shobjidl.h")] [Flags] public enum FCW : uint { /// The browser's media bar. FCW_INTERNETBAR = 0x0006, /// The browser's progress bar. FCW_PROGRESS = 0x0008, /// The browser's status bar. FCW_STATUS = 0x0001, /// The browser's toolbar. FCW_TOOLBAR = 0x0002, /// The browser's tree view. FCW_TREE = 0x0003, } /// Folder view flags. [PInvokeData("shobjidl.h")] [Flags] public enum FOLDERFLAGS : uint { /// Windows 7 and later. No special view options. FWF_NONE = 0x00000000, /// /// Automatically arrange the elements in the view. This implies LVS_AUTOARRANGE if the list-view control is used to implement /// the view. /// FWF_AUTOARRANGE = 0x00000001, /// Not supported. FWF_ABBREVIATEDNAMES = 0x00000002, /// Not supported. FWF_SNAPTOGRID = 0x00000004, /// Not supported. FWF_OWNERDATA = 0x00000008, /// Not supported. FWF_BESTFITWINDOW = 0x00000010, /// /// Make the folder behave like the desktop. This value applies only to the desktop and is not used for typical Shell folders. /// This flag implies FWF_NOCLIENTEDGE and FWF_NOSCROLL. /// FWF_DESKTOP = 0x00000020, /// Do not allow more than a single item to be selected. This is used in the common dialog boxes. FWF_SINGLESEL = 0x00000040, /// Do not show subfolders. FWF_NOSUBFOLDERS = 0x00000080, /// Draw transparently. This is used only for the desktop. FWF_TRANSPARENT = 0x00000100, /// Not supported. FWF_NOCLIENTEDGE = 0x00000200, /// Do not add scroll bars. This is used only for the desktop. FWF_NOSCROLL = 0x00000400, /// /// The view should be left-aligned. This implies LVS_ALIGNLEFT if the list-view control is used to implement the view. /// FWF_ALIGNLEFT = 0x00000800, /// The view should not display icons. FWF_NOICONS = 0x00001000, /// This flag is deprecated as of Windows XP and has no effect. Always show the selection. FWF_SHOWSELALWAYS = 0x00002000, /// Not supported. FWF_NOVISIBLE = 0x00004000, /// Not supported. FWF_SINGLECLICKACTIVATE = 0x00008000, /// The view should not be shown as a web view. FWF_NOWEBVIEW = 0x00010000, /// The view should not display file names. FWF_HIDEFILENAMES = 0x00020000, /// Turns on the check mode for the view. FWF_CHECKSELECT = 0x00040000, /// /// Windows Vista and later. Do not re-enumerate the view (or drop the current contents of the view) when the view is refreshed. /// FWF_NOENUMREFRESH = 0x00080000, /// Windows Vista and later. Do not allow grouping in the view FWF_NOGROUPING = 0x00100000, /// Windows Vista and later. When an item is selected, the item and all its sub-items are highlighted. FWF_FULLROWSELECT = 0x00200000, /// Windows Vista and later. Do not display filters in the view. FWF_NOFILTERS = 0x00400000, /// Windows Vista and later. Do not display a column header in the view in any view mode. FWF_NOCOLUMNHEADER = 0x00800000, /// Windows Vista and later. Only show the column header in details view mode. FWF_NOHEADERINALLVIEWS = 0x01000000, /// /// Windows Vista and later. When the view is in "tile view mode" the layout of a single item should be extended to the width of /// the view. /// FWF_EXTENDEDTILES = 0x02000000, /// Windows Vista and later. Not supported. FWF_TRICHECKSELECT = 0x04000000, /// Windows Vista and later. Items can be selected using checkboxes. FWF_AUTOCHECKSELECT = 0x08000000, /// Windows Vista and later. The view should not save view state in the browser. FWF_NOBROWSERVIEWSTATE = 0x10000000, /// Windows Vista and later. The view should list the number of items displayed in each group. To be used with IFolderView2::SetGroupSubsetCount. FWF_SUBSETGROUPS = 0x20000000, /// Windows Vista and later. Use the search folder for stacking and searching. FWF_USESEARCHFOLDER = 0x40000000, /// /// Windows Vista and later. Ensure right-to-left reading layout in a right-to-left system. Without this flag, the view displays /// strings from left-to-right both on systems set to left-to-right and right-to-left reading layout, which ensures that file /// names display correctly. /// FWF_ALLOWRTLREADING = 0x80000000, } /// The view mode of a folder. [PInvokeData("shobjidl.h")] public enum FOLDERVIEWMODE { /// The view should determine the best option. FVM_AUTO = -1, /// Windows 7 and later. The view should display content mode. FVM_CONTENT = 8, /// Object names and other selected information, such as the size or date last updated, are shown. FVM_DETAILS = 4, /// The view should display medium-size icons. FVM_ICON = 1, /// Object names are displayed in a list view. FVM_LIST = 3, /// The view should display small icons. FVM_SMALLICON = 2, /// The view should display thumbnail icons. FVM_THUMBNAIL = 5, /// The view should display icons in a filmstrip format. FVM_THUMBSTRIP = 7, /// The view should display large icons. FVM_TILE = 6, } /// /// Used by methods of the IFolderViewOptions interface to activate Windows Vista options not supported by default in Windows 7 and /// later systems as well as deactivating new Windows 7 options. /// [PInvokeData("shobjidl.h")] [Flags] public enum FOLDERVIEWOPTIONS { /// Do not use any special options. FVO_DEFAULT = 0x00000000, /// /// Use the Windows Vista list view. This can be used to maintain continuity between systems so that users are presented with an /// expected view. At this time, setting this flag has the effective, though not literal, result of the application of the /// FVO_CUSTOMPOSITION and FVO_CUSTOMORDERING flags. However, this could change. Applications should be specific about the /// behaviors that they require. For instance, if an application requires custom positioning of its items, it should not rely on /// FVO_VISTALAYOUT to provide it, but instead explicitly apply the FVO_CUSTOMPOSITION flag. /// FVO_VISTALAYOUT = 0x00000001, /// /// Items require custom positioning within the space of the view. Those items are positioned to specific coordinates. This /// option is not active by default in the Windows 7 view. /// FVO_CUSTOMPOSITION = 0x00000002, /// /// Items require custom ordering within the view. This option is not active by default in the Windows 7 view. When it is /// active, the user can reorder the view by dragging items to their desired locations. /// FVO_CUSTOMORDERING = 0x00000004, /// /// Tiles and Details displays can contain hyperlinks. This option is not active by default in the Windows 7 view. When /// hyperlinks are displayed, they are updated to the Windows 7 view. /// FVO_SUPPORTHYPERLINKS = 0x00000008, /// /// Do not display animations in the view. This option was introduced in Windows 7 and is active by default in the Windows 7 view. /// FVO_NOANIMATIONS = 0x00000010, /// Do not show scroll tips. This option was introduced in Windows 7 and is active by default in the Windows 7 view. FVO_NOSCROLLTIPS = 0x00000020, } /// Flags specifying the folder to be browsed. [PInvokeData("shobjidl.h")] [Flags] public enum SBSP : uint { /// An absolute PIDL, relative to the desktop. SBSP_ABSOLUTE = 0x0000, /// Windows Vista and later. Navigate without the default behavior of setting focus into the new view. SBSP_ACTIVATE_NOFOCUS = 0x00080000, /// Enable auto-navigation. SBSP_ALLOW_AUTONAVIGATE = 0x00010000, /// /// Microsoft Internet Explorer 6 Service Pack 2 (SP2) and later. The navigation was possibly initiated by a webpage with /// scripting code already present on the local system. /// SBSP_CALLERUNTRUSTED = 0x00800000, /// /// Windows 7 and later. Do not add a new entry to the travel log. When the user enters a search term in the search box and /// subsequently refines the query, the browser navigates forward but does not add an additional travel log entry. /// SBSP_CREATENOHISTORY = 0x00100000, /// /// Use default behavior, which respects the view option (the user setting to create new windows or to browse in place). In most /// cases, calling applications should use this flag. /// SBSP_DEFBROWSER = 0x0000, /// Use the current window. SBSP_DEFMODE = 0x0000, /// /// Specifies a folder tree for the new browse window. If the current browser does not match the SBSP_EXPLOREMODE of the browse /// object call, a new window is opened. /// SBSP_EXPLOREMODE = 0x0020, /// /// Windows Internet Explorer 7 and later. If allowed by current registry settings, give the browser a destination to navigate to. /// SBSP_FEEDNAVIGATION = 0x20000000, /// Not supported. Do not use. SBSP_HELPMODE = 0x0040, /// Undocumented SBSP_INITIATEDBYHLINKFRAME = 0x80000000, /// Windows Vista and later. Not supported. Do not use. SBSP_KEEPSAMETEMPLATE = 0x00020000, /// Windows Vista and later. Navigate without clearing the search entry field. SBSP_KEEPWORDWHEELTEXT = 0x00040000, /// Navigate back, ignore the PIDL. SBSP_NAVIGATEBACK = 0x4000, /// Navigate forward, ignore the PIDL. SBSP_NAVIGATEFORWARD = 0x8000, /// Creates another window for the specified folder. SBSP_NEWBROWSER = 0x0002, /// Suppress selection in the history pane. SBSP_NOAUTOSELECT = 0x04000000, /// Do not transfer the browsing history to the new window. SBSP_NOTRANSFERHIST = 0x0080, /// /// Specifies no folder tree for the new browse window. If the current browser does not match the SBSP_OPENMODE of the browse /// object call, a new window is opened. /// SBSP_OPENMODE = 0x0010, /// Browse the parent folder, ignore the PIDL. SBSP_PARENT = 0x2000, /// Windows 7 and later. Do not make the navigation complete sound for each keystroke in the search box. SBSP_PLAYNOSOUND = 0x00200000, /// Enables redirection to another URL. SBSP_REDIRECT = 0x40000000, /// A relative PIDL, relative to the current folder. SBSP_RELATIVE = 0x1000, /// Browse to another folder with the same Windows Explorer window. SBSP_SAMEBROWSER = 0x0001, /// Microsoft Internet Explorer 6 Service Pack 2 (SP2) and later. The navigate should allow ActiveX prompts. SBSP_TRUSTEDFORACTIVEX = 0x10000000, /// /// Microsoft Internet Explorer 6 Service Pack 2 (SP2) and later. The new window is the result of a user initiated action. Trust /// the new window if it immediately attempts to download content. /// SBSP_TRUSTFIRSTDOWNLOAD = 0x01000000, /// /// Microsoft Internet Explorer 6 Service Pack 2 (SP2) and later. The window is navigating to an untrusted, non-HTML file. If /// the user attempts to download the file, do not allow the download. /// SBSP_UNTRUSTEDFORDOWNLOAD = 0x02000000, /// Write no history of this navigation in the history Shell folder. SBSP_WRITENOHISTORY = 0x08000000 } /// Flags used by IShellFolderViewCB::MessageSFVCB. [PInvokeData("shobjidl.h")] public enum SFVM { /// Allows the callback object to provide a page to add to the Properties property sheet of the selected object. SFVM_ADDPROPERTYPAGES = 47, /// Allows the callback object to request that enumeration be done on a background thread. SFVM_BACKGROUNDENUM = 32, /// Notifies the callback object that background enumeration is complete. SFVM_BACKGROUNDENUMDONE = 48, /// /// Notifies the callback object that the user has clicked a column header to sort the list of objects in the folder view. /// SFVM_COLUMNCLICK = 24, /// Allows the callback object to specify the number of items in the folder view. SFVM_DEFITEMCOUNT = 26, /// Allows the callback object to specify the view mode. SFVM_DEFVIEWMODE = 27, /// Notifies the callback function that a drag-and-drop operation has begun. SFVM_DIDDRAGDROP = 36, /// Notifies the callback object that an event has taken place that affects one of its items. SFVM_FSNOTIFY = 14, /// /// Allows the callback object to specify that an animation be displayed while items are enumerated on a background thread. /// SFVM_GETANIMATION = 68, /// Allows the callback object to add buttons to the toolbar. SFVM_GETBUTTONINFO = 5, /// Allows the callback object to specify the buttons to be added to the toolbar. SFVM_GETBUTTONS = 6, /// /// Allows the callback object to provide the details for an item in a Shell folder. Use only if a call to GetDetailsOf fails /// and there is no GetDetailsOf method available to call. /// SFVM_GETDETAILSOF = 23, /// Allows the callback object to specify a help text string for menu items or toolbar buttons. SFVM_GETHELPTEXT = 3, /// Allows the callback object to specify a Help file and topic. SFVM_GETHELPTOPIC = 63, /// Specifies which events will generate an SFVM_FSNOTIFY message for a given item. SFVM_GETNOTIFY = 49, /// Allows the callback object to provide the status bar pane in which to display the Internet zone information. SFVM_GETPANE = 59, /// Allows the callback object to specify default sorting parameters. SFVM_GETSORTDEFAULTS = 53, /// Allows the callback object to specify a tooltip text string for menu items or toolbar buttons. SFVM_GETTOOLTIPTEXT = 4, /// Allows the callback object to provide Internet zone information. SFVM_GETZONE = 58, /// Allows the callback object to modify an item's context menu. SFVM_INITMENUPOPUP = 7, /// Notifies the callback object that one of its toolbar or menu commands has been invoked. SFVM_INVOKECOMMAND = 2, /// Allows the callback object to merge menu items into the Windows Explorer menus. SFVM_MERGEMENU = 1, /// Allows the callback object to register a folder so that changes to that folder's view will generate notifications. SFVM_QUERYFSNOTIFY = 25, /// /// Notifies the callback object of the container site. This is used only when IObjectWithSite::SetSite is not supported and /// SHCreateShellFolderViewEx is used. /// SFVM_SETISFV = 39, /// Notifies the callback object that the folder view has been resized. SFVM_SIZE = 57, /// /// Allows the callback object to specify the view's PIDL. This is used only when SetIDList and IPersistFolder2::GetCurFolder /// have failed. /// SFVM_THISIDLIST = 41, /// Notifies the callback object that a menu is being removed. SFVM_UNMERGEMENU = 28, /// Allows the callback object to request that the status bar be updated. SFVM_UPDATESTATUSBAR = 31, /// Notifies the callback object that the folder view window is being created. SFVM_WINDOWCREATED = 15, } /// The type of view requested. [PInvokeData("shobjidl.h")] public enum SV2GV : int { /// Current Shell view. SV2GV_CURRENTVIEW = -1, /// Default Shell view. SV2GV_DEFAULTVIEW = -2, } /// Flags that specify details of the view being created. [PInvokeData("shobjidl.h")] [Flags] public enum SV3CVW3_FLAGS { /// The default view. SV3CVW3_DEFAULT = 0x00000000, /// In the case of an error, the view should fail silently rather than displaying a UI. SV3CVW3_NONINTERACTIVE = 0x00000001, /// The view mode set by IShellView3::CreateViewWindow3 overrides the saved view state. SV3CVW3_FORCEVIEWMODE = 0x00000002, /// Folder flags set by IShellView3::CreateViewWindow3 override the saved view state. SV3CVW3_FORCEFOLDERFLAGS = 0x00000004, } /// Selection flags for IShellView objects. [Flags] [PInvokeData("shobjidl.h")] public enum SVSIF : uint { /// Deselect the item. SVSI_DESELECT = 0x00000000, /// Select the item. SVSI_SELECT = 0x00000001, /// Put the name of the item into rename mode. This value includes SVSI_SELECT. SVSI_EDIT = 0x00000003, /// Deselect all but the selected item. If the item parameter is NULL, deselect all items. SVSI_DESELECTOTHERS = 0x00000004, /// /// In the case of a folder that cannot display all of its contents on one screen, display the portion that contains the /// selected item. /// SVSI_ENSUREVISIBLE = 0x00000008, /// /// Give the selected item the focus when multiple items are selected, placing the item first in any list of the collection /// returned by a method. /// SVSI_FOCUSED = 0x00000010, /// Convert the input point from screen coordinates to the list-view client coordinates. SVSI_TRANSLATEPT = 0x00000020, /// Mark the item so that it can be queried using IFolderView::GetSelectionMarkedItem. SVSI_SELECTIONMARK = 0x00000040, /// /// Allows the window's default view to position the item. In most cases, this will place the item in the first available /// position. However, if the call comes during the processing of a mouse-positioned context menu, the position of the context /// menu is used to position the item. /// SVSI_POSITIONITEM = 0x00000080, /// The item should be checked. This flag is used with items in views where the checked mode is supported. SVSI_CHECK = 0x00000100, /// /// The second check state when the view is in tri-check mode, in which there are three values for the checked state. You can /// indicate tri-check mode by specifying FWF_TRICHECKSELECT in IFolderView2::SetCurrentFolderFlags. The 3 states for /// FWF_TRICHECKSELECT are unchecked, SVSI_CHECK and SVSI_CHECK2. /// SVSI_CHECK2 = 0x00000200, /// Selects the item and marks it as selected by the keyboard. This value includes SVSI_SELECT. SVSI_KEYBOARDSELECT = 0x00000401, /// An operation to select or focus an item should not also set focus on the view itself. SVSI_NOTAKEFOCUS = 0x40000000, } /// Flag specifying the activation state of the window. [PInvokeData("shobjidl.h")] public enum SVUIA : uint { /// /// Windows Explorer is about to destroy the Shell view window. The Shell view should remove all extended user interfaces. These /// are typically merged menus and merged modeless pop-up windows. /// SVUIA_DEACTIVATE = 0, /// /// The Shell view is losing the input focus, or it has just been created without the input focus. The Shell view should be able /// to set menu items appropriate for the nonfocused state. This means no selection-specific items should be added. /// SVUIA_ACTIVATE_NOFOCUS = 1, /// /// Windows Explorer has just created the view window with the input focus. This means the Shell view should be able to set menu /// items appropriate for the focused state. /// SVUIA_ACTIVATE_FOCUS = 2, /// /// The Shell view is active without focus. This flag is only used when UIActivate is exposed through the IShellView2 interface. /// SVUIA_INPLACEACTIVATE = 3 } /// Allows a browser or host to ask IShellView what kind of view behavior is supported. // https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nn-shobjidl_core-ibrowserframeoptions [ComImport, Guid("10DF43C8-1DBE-11d3-8B34-006097DF5BD4"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface IBrowserFrameOptions { /// Retrieves the available browser frame view options. /// /// Type: BROWSERFRAMEOPTIONS /// Specifies the options requested as a bitwise combination of one or more of the constants of enumeration type BROWSERFRAMEOPTIONS. /// /// /// Type: BROWSERFRAMEOPTIONS* /// /// When this method returns, contains the options that the view can enable (for example, IShellView ). This value is not /// optional and is always equal to, or a subset of, the options specified by dwMask. /// /// /// /// Type: HRESULT /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. /// /// /// If the method succeeds, the return value is S_OK and pdwOptions contains the subset of available view options. If the method /// fails, pdwOptions is set to BFO_NONE. /// // https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-ibrowserframeoptions-getframeoptions // HRESULT GetFrameOptions( BROWSERFRAMEOPTIONS dwMask, BROWSERFRAMEOPTIONS *pdwOptions ); [PreserveSig] HRESULT GetFrameOptions([In] BROWSERFRAMEOPTIONS dwMask, out BROWSERFRAMEOPTIONS pdwOptions); } /// /// Exposes methods that allow control of folder view options specific to the Windows 7 and later views. /// /// /// When to Implement /// /// An implementation of this interface is provided with Windows as part of CLSID_ExplorerBrowser and CLSID_ShellBrowser. Third /// parties do not implement this interface. /// /// When to Use /// /// By default, the Windows 7 item view does not support custom positioning, custom ordering, or hyperlinks, which were supported in /// the Windows Vista list view. Use this interface when you require those features of the older view. If, at some later time, the /// item view adds support for those features, these options will automatically use the newer view rather than continuing to revert /// to the older view as they currently do. /// /// Use this interface to turn off animation and scroll tip view options new to Windows 7. /// Use this interface to retrieve the current view settings for all of those options. /// // https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl/nn-shobjidl-ifolderviewoptions [PInvokeData("shobjidl.h", MSDNShortId = "4831e62c-45e4-435d-b926-0e140cbfb6fc", MinClient = PInvokeClient.Windows7)] [ComImport, Guid("3cc974d2-b302-4d36-ad3e-06d93f695d3f"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface IFolderViewOptions { /// Sets specified options for the view. /// /// A bitmask made up of one or more of the FOLDERVIEWOPTIONS flags to indicate which options' are being changed. Values in /// fvoFlags not included in this mask are ignored. /// /// /// A bitmask that contains the new values for the options specified in fvoMask. To enable an option, the bitmask should include /// the FOLDERVIEWOPTIONS flag for that option. To disable an option, the bit used for that FOLDERVIEWOPTIONS flag should be 0. /// void SetFolderViewOptions(FOLDERVIEWOPTIONS fvoMask, FOLDERVIEWOPTIONS fvoFlags); /// Retrieves the current set of options for the view. /// /// A bitmask that, when this method returns successfully, receives the FOLDERVIEWOPTIONS values that are currently set. /// FOLDERVIEWOPTIONS GetFolderViewOptions(); } /// /// Implemented by hosts of Shell views (objects that implement IShellView). Exposes methods that provide services for the /// view it is hosting and other objects that run in the context of the Explorer window. /// // https://msdn.microsoft.com/en-us/library/windows/desktop/bb775123(v=vs.85).aspx [PInvokeData("Shobjidl.h", MSDNShortId = "bb775123")] [ComImport, Guid("000214E2-0000-0000-C000-000000000046"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface IShellBrowser : IOleWindow { /// /// Retrieves a handle to one of the windows participating in in-place activation (frame, document, parent, or in-place object window). /// /// A pointer to a variable that receives the window handle. /// /// This method returns S_OK on success. Other possible return values include the following. /// /// /// Return code /// Description /// /// /// E_FAIL /// The object is windowless. /// /// /// E_OUTOFMEMORY /// There is insufficient memory available for this operation. /// /// /// E_UNEXPECTED /// An unexpected error has occurred. /// /// /// /// /// /// Five types of windows comprise the windows hierarchy. When a object is active in place, it has access to some or all of /// these windows. /// /// /// /// Window /// Description /// /// /// Frame /// The outermost main window where the container application's main menu resides. /// /// /// Document /// The window that displays the compound document containing the embedded object to the user. /// /// /// Pane /// /// The subwindow of the document window that contains the object's view. Applicable only for applications with split-pane windows. /// /// /// /// Parent /// /// The container window that contains that object's view. The object application installs its window as a child of this window. /// /// /// /// In-place /// /// The window containing the active in-place object. The object application creates this window and installs it as a child of /// its hatch window, which is a child of the container's parent window. /// /// /// /// /// Each type of window has a different role in the in-place activation architecture. However, it is not necessary to employ a /// separate physical window for each type. Many container applications use the same window for their frame, document, pane, and /// parent windows. /// /// [PreserveSig] new HRESULT GetWindow(out HWND phwnd); /// Determines whether context-sensitive help mode should be entered during an in-place activation session. /// /// if help mode should be entered; if it should be exited. /// /// /// /// This method returns S_OK if the help mode was entered or exited successfully, depending on the value passed in . Other possible return values include the following.
///
/// /// /// Return code /// Description /// /// /// E_INVALIDARG /// The specified value is not valid. /// /// /// E_OUTOFMEMORY /// There is insufficient memory available for this operation. /// /// /// E_UNEXPECTED /// An unexpected error has occurred. /// /// ///
/// /// Applications can invoke context-sensitive help when the user: /// /// presses SHIFT+F1, then clicks a topic /// presses F1 when a menu item is selected /// /// /// When SHIFT+F1 is pressed, either the frame or active object can receive the keystrokes. If the container's frame receives /// the keystrokes, it calls its containing document's IOleWindow::ContextSensitiveHelp method with set to . This propagates the help state to all of its in-place objects so they can /// correctly handle the mouse click or WM_COMMAND. /// /// /// If an active object receives the SHIFT+F1 keystrokes, it calls the container's IOleWindow::ContextSensitiveHelp method with /// set to , which then recursively calls each of its in-place sites until /// there are no more to be notified. The container then calls its document's or frame's IOleWindow::ContextSensitiveHelp method /// with set to . /// /// When in context-sensitive help mode, an object that receives the mouse click can either: /// /// Ignore the click if it does not support context-sensitive help. /// /// Tell all the other objects to exit context-sensitive help mode with ContextSensitiveHelp set to FALSE and then provide help /// for that context. /// /// /// /// An object in context-sensitive help mode that receives a WM_COMMAND should tell all the other in-place objects to exit /// context-sensitive help mode and then provide help for the command. /// /// /// If a container application is to support context-sensitive help on menu items, it must either provide its own message filter /// so that it can intercept the F1 key or ask the OLE library to add a message filter by calling OleSetMenuDescriptor, passing /// valid, non-NULL values for the lpFrame and lpActiveObj parameters. /// /// [PreserveSig] new HRESULT ContextSensitiveHelp([MarshalAs(UnmanagedType.Bool)] bool fEnterMode); /// /// Allows the container to insert its menu groups into the composite menu that is displayed when an extended namespace is being /// viewed or used. /// /// A handle to an empty menu. /// /// The address of an OLEMENUGROUPWIDTHS array of six LONG values. The container fills in elements 0, 2, and 4 to reflect the /// number of menu elements it provided in the File, View, and Window menu groups. /// [PreserveSig] HRESULT InsertMenusSB(HMENU hmenuShared, ref OLEMENUGROUPWIDTHS lpMenuWidths); /// Installs the composite menu in the view window. /// /// A handle to the composite menu constructed by calls to IShellBrowser::InsertMenusSB and the InsertMenu function. /// /// /// The view's window handle. [PreserveSig] HRESULT SetMenuSB(HMENU hmenuShared, IntPtr holemenuRes, HWND hwndActiveObject); /// /// Permits the container to remove any of its menu elements from the in-place composite menu and to free all associated resources. /// /// /// A handle to the in-place composite menu that was constructed by calls to IShellBrowser::InsertMenusSB and the InsertMenu function. /// [PreserveSig] HRESULT RemoveMenusSB(HMENU hmenuShared); /// Sets and displays status text about the in-place object in the container's frame-window status bar. /// A pointer to a null-terminated character string that contains the message to display. [PreserveSig] HRESULT SetStatusTextSB([MarshalAs(UnmanagedType.LPWStr)] string pszStatusText); /// Tells Windows Explorer to enable or disable its modeless dialog boxes. /// /// Specifies whether the modeless dialog boxes are to be enabled or disabled. If this parameter is nonzero, modeless dialog /// boxes are enabled. If this parameter is zero, modeless dialog boxes are disabled. /// [PreserveSig] HRESULT EnableModelessSB([MarshalAs(UnmanagedType.Bool)] bool fEnable); /// Translates accelerator keystrokes intended for the browser's frame while the view is active. /// The address of an MSG structure containing the keystroke message. /// /// The command identifier value corresponding to the keystroke in the container-provided accelerator table. Containers should /// use this value instead of translating again. /// [PreserveSig] HRESULT TranslateAcceleratorSB(ref MSG pmsg, ushort wID); /// Informs Windows Explorer to browse to another folder. /// /// The address of an ITEMIDLIST (item identifier list) structure that specifies an object's location. This value is dependent /// on the flag or flags set in the wFlags parameter. /// /// Flags specifying the folder to be browsed. [PreserveSig] HRESULT BrowseObject(IntPtr pidl, SBSP wFlags); /// Gets an IStream interface that can be used for storage of view-specific state information. /// Read/write access of the IStream interface. /// The address that receives the IStream interface pointer. [PreserveSig] HRESULT GetViewStateStream(STGM grfMode, [MarshalAs(UnmanagedType.Interface)] out IStream ppStrm); /// Gets the window handle to a browser control. /// /// Type: UINT /// The control handle that is being requested. This parameter can be one of the following values: /// FCW_TOOLBAR /// Retrieves the window handle to the browser's toolbar. /// FCW_STATUS /// Retrieves the window handle to the browser's status bar. /// FCW_TREE /// Retrieves the window handle to the browser's tree view. /// FCW_PROGRESS /// Retrieves the window handle to the browser's progress bar. /// /// /// Type: HWND* /// The address of the window handle to the Windows Explorer control. /// /// /// Type: HRESULT /// Returns S_OK if successful, or a COM-defined error value otherwise. /// /// /// GetControlWindow is used so views can directly manipulate the browser's controls. FCW_TREE should be used only to determine if the tree is present. /// Notes to Calling Applications /// GetControlWindow is used to manipulate and test the state of the control windows. Do not send messages directly to these controls; instead, use IShellBrowser::SendControlMsg. Be prepared for this method to return NULL. Later versions of Windows Explorer may not include a toolbar, status bar, or tree window. /// Notes to Implementers /// GetControlWindow returns the window handle to these controls if they exist in your implementation. /// See also IShellBrowser /// // https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-ishellbrowser-getcontrolwindow [PreserveSig] HRESULT GetControlWindow(FCW id, out HWND phwnd ); /// Sends control messages to either the toolbar or the status bar in a Windows Explorer window. /// /// Type: UINT /// An identifier for either a toolbar (FCW_TOOLBAR) or for a status bar window (FCW_STATUS). /// /// /// Type: UINT /// The message to be sent to the control. /// /// /// Type: WPARAM /// The value depends on the message specified in the uMsg parameter. /// /// /// Type: LPARAM /// The value depends on the message specified in the uMsg parameter. /// /// /// Type: LRESULT* /// The address of the return value of the SendMessage function. /// /// /// Type: HRESULT /// Returns S_OK if successful, or a COM-defined error value otherwise. /// /// /// Refer to the Common Controls documentation for more information on the messages that can be sent to the toolbar or status bar control. /// Notes to Calling Applications /// Use of this call requires diligent attention, because leaving either the status bar or toolbar in an inappropriate state will affect the performance of Windows Explorer. /// Notes to Implementers /// If your Windows Explorer does not have these controls, you can return E_NOTIMPL. /// // https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-ishellbrowser-sendcontrolmsg [PreserveSig] HRESULT SendControlMsg(FCW id, uint uMsg, IntPtr wParam, IntPtr lParam, out IntPtr pret ); /// Retrieves the currently active (displayed) Shell view object. /// /// Type: IShellView** /// The address of the pointer to the currently active Shell view object. /// /// /// Type: HRESULT /// Returns S_OK if successful, or a COM-defined error value otherwise. /// /// /// Notes to Calling Applications /// Because the IShellBrowser interface can host several Shell views simultaneously, this method provides an easy way to determine the active Shell view object. /// // https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-ishellbrowser-queryactiveshellview [PreserveSig] HRESULT QueryActiveShellView(out IShellView ppshv); /// Called by the Shell view when the view window or one of its child windows gets the focus or becomes active. /// Address of the view object's IShellView pointer. [PreserveSig] HRESULT OnViewWindowActive(IShellView ppshv); /// /// This method has no effect on Windows Vista or later operating systems. Adds toolbar items to /// Windows Explorer's toolbar. /// /// The address of an array of TBBUTTON structures. /// The number of TBBUTTON structures in the lpButtons array. /// Flags specifying where the toolbar buttons should go. [PreserveSig] HRESULT SetToolbarItems([Optional, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] TBBUTTON[] lpButtons, uint nButtons, FCT uFlags); } /// /// Exposes a method that allows communication between Windows Explorer and a folder view implemented using the system folder view /// object (the IShellView object returned through SHCreateShellFolderView) so that the folder view can be notified of /// events and modify its view accordingly. /// // https://msdn.microsoft.com/en-us/library/windows/desktop/bb774967(v=vs.85).aspx [PInvokeData("Shlobj.h", MSDNShortId = "bb774967")] [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("2047E320-F2A9-11CE-AE65-08002B2E1262")] public interface IShellFolderViewCB { /// Allows communication between the system folder view object and a system folder view callback object. /// One of the following notifications. /// Additional information. /// Additional information. /// Additional information. /// S_OK if the message was handled, E_NOTIMPL if the shell should perform default processing. [PreserveSig] HRESULT MessageSFVCB(SFVM uMsg, IntPtr wParam, IntPtr lParam, ref IntPtr plResult); } /// /// Exposes methods that present a view in the Windows Explorer or folder windows. /// /// /// /// The object that exposes IShellView is typically created by a call to the IShellFolder::CreateViewObject method. This /// provides the channel of communication between a view object and Windows Explorer's outermost frame window. The communication /// involves the translation of messages, the state of the frame window (activated or deactivated), the state of the document window /// (activated or deactivated), and the merging of menus and toolbar items. /// /// /// This interface is implemented by namespace extensions that display themselves in Windows Explorer's namespace. This object is /// created by the IShellFolder object that hosts the view. /// /// These methods are used by the Shell view's Windows Explorer window to manipulate objects while they are active. /// IShellView is derived from IOleWindow. The listed methods are specific to IShellView. /// /// A special instance of IShellView known as the default Shell folder view object can be created by calling /// SHCreateShellFolderView or SHCreateShellFolderViewEx. This instance can be differentiated from standard implementations by /// calling QueryInterface on an IShellView object using the IID_CDefView IID. This call succeeds only when made on the /// default Shell folder view object. /// /// // https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/nn-shobjidl_core-ishellview [PInvokeData("shobjidl_core.h", MSDNShortId = "91438583-e4f1-456f-a130-2a45846fd725")] [ComImport, Guid("000214E3-0000-0000-C000-000000000046"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface IShellView : IOleWindow { /// /// Retrieves a handle to one of the windows participating in in-place activation (frame, document, parent, or in-place object window). /// /// A pointer to a variable that receives the window handle. /// /// This method returns S_OK on success. Other possible return values include the following. /// /// /// Return code /// Description /// /// /// E_FAIL /// The object is windowless. /// /// /// E_OUTOFMEMORY /// There is insufficient memory available for this operation. /// /// /// E_UNEXPECTED /// An unexpected error has occurred. /// /// /// /// /// /// Five types of windows comprise the windows hierarchy. When a object is active in place, it has access to some or all of /// these windows. /// /// /// /// Window /// Description /// /// /// Frame /// The outermost main window where the container application's main menu resides. /// /// /// Document /// The window that displays the compound document containing the embedded object to the user. /// /// /// Pane /// /// The subwindow of the document window that contains the object's view. Applicable only for applications with split-pane windows. /// /// /// /// Parent /// /// The container window that contains that object's view. The object application installs its window as a child of this window. /// /// /// /// In-place /// /// The window containing the active in-place object. The object application creates this window and installs it as a child of /// its hatch window, which is a child of the container's parent window. /// /// /// /// /// Each type of window has a different role in the in-place activation architecture. However, it is not necessary to employ a /// separate physical window for each type. Many container applications use the same window for their frame, document, pane, and /// parent windows. /// /// [PreserveSig] new HRESULT GetWindow(out HWND phwnd); /// Determines whether context-sensitive help mode should be entered during an in-place activation session. /// /// if help mode should be entered; if it should be exited. /// /// /// /// This method returns S_OK if the help mode was entered or exited successfully, depending on the value passed in . Other possible return values include the following.
///
/// /// /// Return code /// Description /// /// /// E_INVALIDARG /// The specified value is not valid. /// /// /// E_OUTOFMEMORY /// There is insufficient memory available for this operation. /// /// /// E_UNEXPECTED /// An unexpected error has occurred. /// /// ///
/// /// Applications can invoke context-sensitive help when the user: /// /// presses SHIFT+F1, then clicks a topic /// presses F1 when a menu item is selected /// /// /// When SHIFT+F1 is pressed, either the frame or active object can receive the keystrokes. If the container's frame receives /// the keystrokes, it calls its containing document's IOleWindow::ContextSensitiveHelp method with set to . This propagates the help state to all of its in-place objects so they can /// correctly handle the mouse click or WM_COMMAND. /// /// /// If an active object receives the SHIFT+F1 keystrokes, it calls the container's IOleWindow::ContextSensitiveHelp method with /// set to , which then recursively calls each of its in-place sites until /// there are no more to be notified. The container then calls its document's or frame's IOleWindow::ContextSensitiveHelp method /// with set to . /// /// When in context-sensitive help mode, an object that receives the mouse click can either: /// /// Ignore the click if it does not support context-sensitive help. /// /// Tell all the other objects to exit context-sensitive help mode with ContextSensitiveHelp set to FALSE and then provide help /// for that context. /// /// /// /// An object in context-sensitive help mode that receives a WM_COMMAND should tell all the other in-place objects to exit /// context-sensitive help mode and then provide help for the command. /// /// /// If a container application is to support context-sensitive help on menu items, it must either provide its own message filter /// so that it can intercept the F1 key or ask the OLE library to add a message filter by calling OleSetMenuDescriptor, passing /// valid, non-NULL values for the lpFrame and lpActiveObj parameters. /// /// [PreserveSig] new HRESULT ContextSensitiveHelp([MarshalAs(UnmanagedType.Bool)] bool fEnterMode); /// Translates keyboard shortcut (accelerator) key strokes when a namespace extension's view has the focus. /// The address of the message to be translated. void TranslateAccelerator(in MSG lpmsg); /// Enables or disables modeless dialog boxes. This method is not currently implemented. /// true to enable modeless dialog box windows or false to disable them. void EnableModeless([In, MarshalAs(UnmanagedType.Bool)] bool enable); /// /// Called when the activation state of the view window is changed by an event that is not caused by the Shell view itself. For /// example, if the TAB key is pressed when the tree has the focus, the view should be given the focus. /// /// Flag specifying the activation state of the window. void UIActivate([In] SVUIA uState); /// Refreshes the view's contents in response to user input. void Refresh(); /// /// Creates a view window. This can be either the right pane of Windows Explorer or the client window of a folder window. /// /// /// The address of the IShellView interface of the view window being exited. Views can use this parameter to communicate with a /// previous view of the same implementation. This interface can be used to optimize browsing between like views. This pointer /// may be NULL. /// /// The address of a FOLDERSETTINGS structure. The view should use this when creating its view. /// /// The address of the current instance of the IShellBrowser interface. The view should call this interface's AddRef method and /// keep the interface pointer to allow communication with the Windows Explorer window. /// /// The dimensions of the new view, in client coordinates. /// The address of the window handle being created. HWND CreateViewWindow([In, Optional] IShellView psvPrevious, in FOLDERSETTINGS pfs, [In] IShellBrowser psb, in RECT prcView); /// Destroys the view window. void DestroyViewWindow(); /// Gets the current information. /// A FOLDERSETTINGS structure to receive the settings. FOLDERSETTINGS GetCurrentInfo(); /// Allows the view to add pages to the Options property sheet from the View menu. /// Reserved. /// The address of the callback function used to add the pages. /// A value that must be passed as the callback function's lparam parameter. void AddPropertySheetPages([In, Optional] uint dwReserved, [In] AddPropSheetPageProc lpfn, [In] IntPtr lparam); /// Saves the Shell's view settings so the current state can be restored during a subsequent browsing session. void SaveViewState(); /// Changes the selection state of one or more items within the Shell view window. /// The address of the ITEMIDLIST structure. /// One of the _SVSIF constants that specify the type of selection to apply. void SelectItem([In] IntPtr pidlItem, [In] SVSIF uFlags); /// Gets an interface that refers to data presented in the view. /// The constants that refer to an aspect of the view. /// The identifier of the COM interface being requested. /// The address that receives the interface pointer. If an error occurs, the pointer returned must be NULL. [return: MarshalAs(UnmanagedType.Interface, IidParameterIndex = 1)] object GetItemObject([In] SVGIO uItem, in Guid riid); } /// /// Extends the capabilities of IShellView. /// /// /// This interface also provides the methods of the IShellView interface, from which it inherits. /// When to Implement /// Implement IShellView2 if your namespace extension provides services to clients beyond those in IShellView . /// When to Use /// /// You do not call this interface directly. IShellView2 is used by the operating system only when it has confirmed that your /// application is aware of this interface. Objects that expose IShellView and IShellView2 are usually created by other Shell folder objects. /// /// // https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/nn-shobjidl_core-ishellview2 [PInvokeData("shobjidl_core.h", MSDNShortId = "a61aec39-406d-4066-941d-e788d64f4310")] [ComImport, Guid("88E39E80-3578-11CF-AE69-08002B2E1262"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface IShellView2 : IShellView { /// /// Retrieves a handle to one of the windows participating in in-place activation (frame, document, parent, or in-place object window). /// /// A pointer to a variable that receives the window handle. /// /// This method returns S_OK on success. Other possible return values include the following. /// /// /// Return code /// Description /// /// /// E_FAIL /// The object is windowless. /// /// /// E_OUTOFMEMORY /// There is insufficient memory available for this operation. /// /// /// E_UNEXPECTED /// An unexpected error has occurred. /// /// /// /// /// /// Five types of windows comprise the windows hierarchy. When a object is active in place, it has access to some or all of /// these windows. /// /// /// /// Window /// Description /// /// /// Frame /// The outermost main window where the container application's main menu resides. /// /// /// Document /// The window that displays the compound document containing the embedded object to the user. /// /// /// Pane /// /// The subwindow of the document window that contains the object's view. Applicable only for applications with split-pane windows. /// /// /// /// Parent /// /// The container window that contains that object's view. The object application installs its window as a child of this window. /// /// /// /// In-place /// /// The window containing the active in-place object. The object application creates this window and installs it as a child of /// its hatch window, which is a child of the container's parent window. /// /// /// /// /// Each type of window has a different role in the in-place activation architecture. However, it is not necessary to employ a /// separate physical window for each type. Many container applications use the same window for their frame, document, pane, and /// parent windows. /// /// [PreserveSig] new HRESULT GetWindow(out HWND phwnd); /// Determines whether context-sensitive help mode should be entered during an in-place activation session. /// /// if help mode should be entered; if it should be exited. /// /// /// /// This method returns S_OK if the help mode was entered or exited successfully, depending on the value passed in . Other possible return values include the following.
///
/// /// /// Return code /// Description /// /// /// E_INVALIDARG /// The specified value is not valid. /// /// /// E_OUTOFMEMORY /// There is insufficient memory available for this operation. /// /// /// E_UNEXPECTED /// An unexpected error has occurred. /// /// ///
/// /// Applications can invoke context-sensitive help when the user: /// /// presses SHIFT+F1, then clicks a topic /// presses F1 when a menu item is selected /// /// /// When SHIFT+F1 is pressed, either the frame or active object can receive the keystrokes. If the container's frame receives /// the keystrokes, it calls its containing document's IOleWindow::ContextSensitiveHelp method with set to . This propagates the help state to all of its in-place objects so they can /// correctly handle the mouse click or WM_COMMAND. /// /// /// If an active object receives the SHIFT+F1 keystrokes, it calls the container's IOleWindow::ContextSensitiveHelp method with /// set to , which then recursively calls each of its in-place sites until /// there are no more to be notified. The container then calls its document's or frame's IOleWindow::ContextSensitiveHelp method /// with set to . /// /// When in context-sensitive help mode, an object that receives the mouse click can either: /// /// Ignore the click if it does not support context-sensitive help. /// /// Tell all the other objects to exit context-sensitive help mode with ContextSensitiveHelp set to FALSE and then provide help /// for that context. /// /// /// /// An object in context-sensitive help mode that receives a WM_COMMAND should tell all the other in-place objects to exit /// context-sensitive help mode and then provide help for the command. /// /// /// If a container application is to support context-sensitive help on menu items, it must either provide its own message filter /// so that it can intercept the F1 key or ask the OLE library to add a message filter by calling OleSetMenuDescriptor, passing /// valid, non-NULL values for the lpFrame and lpActiveObj parameters. /// /// [PreserveSig] new HRESULT ContextSensitiveHelp([MarshalAs(UnmanagedType.Bool)] bool fEnterMode); /// Translates keyboard shortcut (accelerator) key strokes when a namespace extension's view has the focus. /// The address of the message to be translated. new void TranslateAccelerator(in MSG lpmsg); /// Enables or disables modeless dialog boxes. This method is not currently implemented. /// true to enable modeless dialog box windows or false to disable them. new void EnableModeless([MarshalAs(UnmanagedType.Bool)] bool enable); /// /// Called when the activation state of the view window is changed by an event that is not caused by the Shell view itself. For /// example, if the TAB key is pressed when the tree has the focus, the view should be given the focus. /// /// Flag specifying the activation state of the window. new void UIActivate(SVUIA uState); /// Refreshes the view's contents in response to user input. new void Refresh(); /// /// Creates a view window. This can be either the right pane of Windows Explorer or the client window of a folder window. /// /// /// The address of the IShellView interface of the view window being exited. Views can use this parameter to communicate with a /// previous view of the same implementation. This interface can be used to optimize browsing between like views. This pointer /// may be NULL. /// /// The address of a FOLDERSETTINGS structure. The view should use this when creating its view. /// /// The address of the current instance of the IShellBrowser interface. The view should call this interface's AddRef method and /// keep the interface pointer to allow communication with the Windows Explorer window. /// /// The dimensions of the new view, in client coordinates. /// The address of the window handle being created. new HWND CreateViewWindow(IShellView psvPrevious, in FOLDERSETTINGS pfs, IShellBrowser psb, in RECT prcView); /// Destroys the view window. new void DestroyViewWindow(); /// Gets the current information. /// A FOLDERSETTINGS structure to receive the settings. new FOLDERSETTINGS GetCurrentInfo(); /// Allows the view to add pages to the Options property sheet from the View menu. /// Reserved. /// The address of the callback function used to add the pages. /// A value that must be passed as the callback function's lparam parameter. new void AddPropertySheetPages(uint dwReserved, [In] AddPropSheetPageProc lpfn, [In] IntPtr lparam); /// Saves the Shell's view settings so the current state can be restored during a subsequent browsing session. new void SaveViewState(); /// Changes the selection state of one or more items within the Shell view window. /// The address of the ITEMIDLIST structure. /// One of the _SVSIF constants that specify the type of selection to apply. new void SelectItem(IntPtr pidlItem, SVSIF uFlags); /// Gets an interface that refers to data presented in the view. /// The constants that refer to an aspect of the view. /// The identifier of the COM interface being requested. /// The address that receives the interface pointer. If an error occurs, the pointer returned must be NULL. [return: MarshalAs(UnmanagedType.Interface, IidParameterIndex = 1)] new object GetItemObject(SVGIO uItem, in Guid riid); /// /// Requests the current or default Shell view, together with all other valid view identifiers (VIDs) supported by this /// implementation of IShellView2. /// /// A pointer to the GUID of the requested view. /// The type of view requested. void GetView(in Guid pvid, SV2GV uView); /// /// Used to request the creation of a new Shell view window. It can be either the right pane of Windows Explorer or the client /// window of a folder window. /// /// A pointer to an SV2CVW2_PARAMS structure that defines the new view window. void CreateViewWindow2(SV2CVW2_PARAMS lpParams); /// Used to change an item's identifier. /// /// A pointer to an ITEMIDLIST structure. The current identifier is passed in and is replaced by the new one. /// void HandleRename(IntPtr pidlNew); /// Selects and positions an item in a Shell View. /// A pointer to an ITEMIDLIST structure that uniquely identifies the item of interest. /// One of the _SVSIF constants that specify the type of selection to apply. /// A pointer to a POINT structure containing the new position. void SelectAndPositionItem(IntPtr pidlItem, SVSIF flags, in POINT point); } /// /// Extends the capabilities of IShellView2 by providing a method to replace IShellView2::CreateViewWindow2. /// /// /// This interface also provides the methods of the IShellView and IShellView2 interfaces, from which it inherits. /// // https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl/nn-shobjidl-ishellview3 [PInvokeData("shobjidl.h", MSDNShortId = "96b61e84-0d31-494d-a922-cd3dcd5735b9")] [ComImport(), Guid("ec39fa88-f8af-41c5-8421-38bed28f4673"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface IShellView3 : IShellView2 { /// /// Retrieves a handle to one of the windows participating in in-place activation (frame, document, parent, or in-place object window). /// /// A pointer to a variable that receives the window handle. /// /// This method returns S_OK on success. Other possible return values include the following. /// /// /// Return code /// Description /// /// /// E_FAIL /// The object is windowless. /// /// /// E_OUTOFMEMORY /// There is insufficient memory available for this operation. /// /// /// E_UNEXPECTED /// An unexpected error has occurred. /// /// /// /// /// /// Five types of windows comprise the windows hierarchy. When a object is active in place, it has access to some or all of /// these windows. /// /// /// /// Window /// Description /// /// /// Frame /// The outermost main window where the container application's main menu resides. /// /// /// Document /// The window that displays the compound document containing the embedded object to the user. /// /// /// Pane /// /// The subwindow of the document window that contains the object's view. Applicable only for applications with split-pane windows. /// /// /// /// Parent /// /// The container window that contains that object's view. The object application installs its window as a child of this window. /// /// /// /// In-place /// /// The window containing the active in-place object. The object application creates this window and installs it as a child of /// its hatch window, which is a child of the container's parent window. /// /// /// /// /// Each type of window has a different role in the in-place activation architecture. However, it is not necessary to employ a /// separate physical window for each type. Many container applications use the same window for their frame, document, pane, and /// parent windows. /// /// [PreserveSig] new HRESULT GetWindow(out HWND phwnd); /// Determines whether context-sensitive help mode should be entered during an in-place activation session. /// /// if help mode should be entered; if it should be exited. /// /// /// /// This method returns S_OK if the help mode was entered or exited successfully, depending on the value passed in . Other possible return values include the following.
///
/// /// /// Return code /// Description /// /// /// E_INVALIDARG /// The specified value is not valid. /// /// /// E_OUTOFMEMORY /// There is insufficient memory available for this operation. /// /// /// E_UNEXPECTED /// An unexpected error has occurred. /// /// ///
/// /// Applications can invoke context-sensitive help when the user: /// /// presses SHIFT+F1, then clicks a topic /// presses F1 when a menu item is selected /// /// /// When SHIFT+F1 is pressed, either the frame or active object can receive the keystrokes. If the container's frame receives /// the keystrokes, it calls its containing document's IOleWindow::ContextSensitiveHelp method with set to . This propagates the help state to all of its in-place objects so they can /// correctly handle the mouse click or WM_COMMAND. /// /// /// If an active object receives the SHIFT+F1 keystrokes, it calls the container's IOleWindow::ContextSensitiveHelp method with /// set to , which then recursively calls each of its in-place sites until /// there are no more to be notified. The container then calls its document's or frame's IOleWindow::ContextSensitiveHelp method /// with set to . /// /// When in context-sensitive help mode, an object that receives the mouse click can either: /// /// Ignore the click if it does not support context-sensitive help. /// /// Tell all the other objects to exit context-sensitive help mode with ContextSensitiveHelp set to FALSE and then provide help /// for that context. /// /// /// /// An object in context-sensitive help mode that receives a WM_COMMAND should tell all the other in-place objects to exit /// context-sensitive help mode and then provide help for the command. /// /// /// If a container application is to support context-sensitive help on menu items, it must either provide its own message filter /// so that it can intercept the F1 key or ask the OLE library to add a message filter by calling OleSetMenuDescriptor, passing /// valid, non-NULL values for the lpFrame and lpActiveObj parameters. /// /// [PreserveSig] new HRESULT ContextSensitiveHelp([MarshalAs(UnmanagedType.Bool)] bool fEnterMode); /// Translates keyboard shortcut (accelerator) key strokes when a namespace extension's view has the focus. /// The address of the message to be translated. new void TranslateAccelerator(in MSG lpmsg); /// Enables or disables modeless dialog boxes. This method is not currently implemented. /// true to enable modeless dialog box windows or false to disable them. new void EnableModeless([MarshalAs(UnmanagedType.Bool)] bool enable); /// /// Called when the activation state of the view window is changed by an event that is not caused by the Shell view itself. For /// example, if the TAB key is pressed when the tree has the focus, the view should be given the focus. /// /// Flag specifying the activation state of the window. new void UIActivate(SVUIA uState); /// Refreshes the view's contents in response to user input. new void Refresh(); /// /// Creates a view window. This can be either the right pane of Windows Explorer or the client window of a folder window. /// /// /// The address of the IShellView interface of the view window being exited. Views can use this parameter to communicate with a /// previous view of the same implementation. This interface can be used to optimize browsing between like views. This pointer /// may be NULL. /// /// The address of a FOLDERSETTINGS structure. The view should use this when creating its view. /// /// The address of the current instance of the IShellBrowser interface. The view should call this interface's AddRef method and /// keep the interface pointer to allow communication with the Windows Explorer window. /// /// The dimensions of the new view, in client coordinates. /// The address of the window handle being created. new HWND CreateViewWindow(IShellView psvPrevious, in FOLDERSETTINGS pfs, IShellBrowser psb, in RECT prcView); /// Destroys the view window. new void DestroyViewWindow(); /// Gets the current information. /// A FOLDERSETTINGS structure to receive the settings. new FOLDERSETTINGS GetCurrentInfo(); /// Allows the view to add pages to the Options property sheet from the View menu. /// Reserved. /// The address of the callback function used to add the pages. /// A value that must be passed as the callback function's lparam parameter. new void AddPropertySheetPages(uint dwReserved, [In] AddPropSheetPageProc lpfn, [In] IntPtr lparam); /// Saves the Shell's view settings so the current state can be restored during a subsequent browsing session. new void SaveViewState(); /// Changes the selection state of one or more items within the Shell view window. /// The address of the ITEMIDLIST structure. /// One of the _SVSIF constants that specify the type of selection to apply. new void SelectItem(IntPtr pidlItem, SVSIF uFlags); /// Gets an interface that refers to data presented in the view. /// The constants that refer to an aspect of the view. /// The identifier of the COM interface being requested. /// The address that receives the interface pointer. If an error occurs, the pointer returned must be NULL. [return: MarshalAs(UnmanagedType.Interface, IidParameterIndex = 1)] new object GetItemObject(SVGIO uItem, in Guid riid); /// /// Requests the current or default Shell view, together with all other valid view identifiers (VIDs) supported by this /// implementation of IShellView2. /// /// A pointer to the GUID of the requested view. /// The type of view requested. new void GetView(in Guid pvid, SV2GV uView); /// /// Used to request the creation of a new Shell view window. It can be either the right pane of Windows Explorer or the client /// window of a folder window. /// /// A pointer to an SV2CVW2_PARAMS structure that defines the new view window. new void CreateViewWindow2(SV2CVW2_PARAMS lpParams); /// Used to change an item's identifier. /// /// A pointer to an ITEMIDLIST structure. The current identifier is passed in and is replaced by the new one. /// new void HandleRename(IntPtr pidlNew); /// Selects and positions an item in a Shell View. /// A pointer to an ITEMIDLIST structure that uniquely identifies the item of interest. /// One of the _SVSIF constants that specify the type of selection to apply. /// A pointer to a POINT structure containing the new position. new void SelectAndPositionItem(IntPtr pidlItem, SVSIF flags, in POINT point); /// /// Requests the creation of a new Shell view window. The view can be either the right pane of Windows Explorer or the client /// window of a folder window. This method replaces CreateViewWindow2. /// /// A pointer to an IShellBrowser interface to provide namespace extension services. /// /// A pointer to an IShellView interface that represents the previous view in the Windows Explorer or folder window. /// /// Flags that specify details of the view being created. /// A bitwise mask that specifies which folder options specified in dwFlags are to be used. /// A bitwise value that contains the folder options, as FOLDERFLAGS, to use in the new view. /// A bitwise value that contains the folder view mode options, as FOLDERVIEWMODE, to use in the new view. /// A pointer to Shell view ID as a GUID. /// A pointer to a RECT structure that provides the dimensions of the view window. /// A value that receives a pointer to the handle of the new Shell view window. HWND CreateViewWindow3(IShellBrowser psbOwner, IShellView psvPrevious, SV3CVW3_FLAGS dwViewFlags, FOLDERFLAGS dwMask, FOLDERFLAGS dwFlags, FOLDERVIEWMODE fvMode, in Guid pvid, in RECT prcView); } /// Gets an interface that refers to data presented in the view. /// The type of the COM interface being requested. /// The instance. /// The constants that refer to an aspect of the view. /// The address that receives the interface pointer. If an error occurs, the pointer returned must be NULL. public static T GetItemObject(this IShellView sv, SVGIO uItem) where T : class => (T)sv.GetItemObject(uItem, typeof(T).GUID); /// Contains folder view information. [PInvokeData("Shobjidl.h")] [StructLayout(LayoutKind.Sequential, Pack = 4)] public struct FOLDERSETTINGS { /// Folder view mode. public FOLDERVIEWMODE ViewMode; /// A set of flags that indicate the options for the folder. public FOLDERFLAGS fFlags; /// Initializes a new instance of the struct. /// Folder view mode. /// A set of flags that indicate the options for the folder. public FOLDERSETTINGS(FOLDERVIEWMODE viewMode, FOLDERFLAGS flags) { ViewMode = viewMode; fFlags = flags; } } /// Contains folder view information. [PInvokeData("Shobjidl.h")] [StructLayout(LayoutKind.Sequential)] public class PFOLDERSETTINGS { private FOLDERSETTINGS settings; /// Folder view mode. public FOLDERVIEWMODE ViewMode { get => settings.ViewMode; set => settings.ViewMode = value; } /// A set of flags that indicate the options for the folder. public FOLDERFLAGS fFlags { get => settings.fFlags; set => settings.fFlags = value; } /// Initializes a new instance of the struct. /// Folder view mode. /// A set of flags that indicate the options for the folder. public PFOLDERSETTINGS(FOLDERVIEWMODE viewMode, FOLDERFLAGS flags) { settings.ViewMode = viewMode; settings.fFlags = flags; } /// Performs an implicit conversion from to . /// The instance. /// The result of the conversion. public static implicit operator FOLDERSETTINGS(PFOLDERSETTINGS r) => r.settings; /// Performs an implicit conversion from to . /// The instance. /// The result of the conversion. public static implicit operator PFOLDERSETTINGS(in FOLDERSETTINGS r) => new PFOLDERSETTINGS(r.ViewMode, r.fFlags); } /// /// Holds the parameters for the IShellView2::CreateViewWindow2 method. /// // https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/ns-shobjidl_core-_sv2cvw2_params typedef struct // _SV2CVW2_PARAMS { DWORD cbSize; IShellView *psvPrev; LPCFOLDERSETTINGS pfs; IShellBrowser *psbOwner; RECT *prcView; const // SHELLVIEWID *pvid; HWND hwndView; } SV2CVW2_PARAMS, *LPSV2CVW2_PARAMS; [PInvokeData("shobjidl_core.h", MSDNShortId = "7e165654-74ea-4d8b-81b7-11257f87af53")] [StructLayout(LayoutKind.Sequential)] public class SV2CVW2_PARAMS : IDisposable { /// The size of the structure. public uint cbSize; /// /// A pointer to the IShellView interface of the previous view. A Shell view can use this parameter to communicate with a /// previous view with the same implementation. It can also be used to optimize browsing between like views. This parameter may /// be NULL. /// public IShellView psvPrev; /// A FOLDERSETTINGS structure with information needed to create the view. private IntPtr _pfs; /// /// A pointer to the current instance of the IShellBrowser interface of the parent Shell browser. IShellView2::CreateViewWindow2 /// should call this interface's AddRef method and store the interface pointer. It can be used for communication with the /// Windows Explorer window. /// public IShellBrowser psbOwner; /// A RECT structure that defines the view's display area. private IntPtr _prcView; /// /// A pointer to a view ID. The view ID can be one of the Windows-defined VIDs or a custom, view-defined VID. This value takes /// precedence over the view mode designated in the FOLDERSETTINGS structure pointed to by pfs. /// private IntPtr _pvid; /// A window handle to the new Shell view. public HWND hwndView; /// Initializes a new instance of the class. /// Folder view mode. /// A set of flags that indicate the options for the folder. /// The current instance of the IShellBrowser interface of the parent Shell browser. /// The view's display area. /// /// Optional. The IShellView interface of the previous view. A Shell view can use this parameter to communicate with a previous /// view with the same implementation. It can also be used to optimize browsing between like views. /// public SV2CVW2_PARAMS(FOLDERVIEWMODE viewMode, FOLDERFLAGS flags, IShellBrowser owner, ref RECT displayArea, IShellView prevView = null) { cbSize = (uint)Marshal.SizeOf(typeof(SV2CVW2_PARAMS)); psvPrev = prevView; psbOwner = owner; pfs = new FOLDERSETTINGS(viewMode, flags); prcView = displayArea; } /// A FOLDERSETTINGS structure with information needed to create the view. public FOLDERSETTINGS pfs { get => _pfs.ToStructure(); set { Marshal.FreeCoTaskMem(_pfs); _pfs = InteropExtensions.MarshalToPtr(value, Marshal.AllocCoTaskMem, out var _); } } /// A RECT structure that defines the view's display area. public RECT prcView { get => _prcView.ToStructure(); set { Marshal.FreeCoTaskMem(_prcView); _prcView = InteropExtensions.MarshalToPtr(value, Marshal.AllocCoTaskMem, out var _); } } /// /// A view ID. The view ID can be one of the Windows-defined VIDs or a custom, view-defined VID. This value takes precedence /// over the view mode designated in the FOLDERSETTINGS structure pointed to by pfs. /// public Guid pvid => _pvid.ToStructure(); /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. void IDisposable.Dispose() { Marshal.FreeCoTaskMem(_pfs); Marshal.FreeCoTaskMem(_prcView); } } } }