Click or drag to resize

ShellBrowser Class

The ShellBrowser component is a non-visual component and allows you to browse to the shell name space of Windows, to query information about shell objects and to perform context menu operations.
Inheritance Hierarchy
SystemObject
  SystemMarshalByRefObject
    System.ComponentModelComponent
      Jam.ShellShellBrowserBase
        Jam.ShellShellBrowser

Namespace: Jam.Shell
Assembly: ShellBrowser (in ShellBrowser.dll) Version: 7.2
Syntax
public class ShellBrowser : ShellBrowserBase

The ShellBrowser type exposes the following members.

Constructors
 NameDescription
Public methodShellBrowser Initializes a new instance of the ShellBrowser class. Since version 4.0 SpecialFolder does not point to Drives anymore, use ShellBrowser(ShellFolder) constructor instead, this is due to performance reasons.
Public methodShellBrowser(ItemIdList) Initializes a new instance of the ShellBrowser class makes the object with the given ItemIdList the active object.
Public methodShellBrowser(ShellBrowser) Initializes a copy of the given ShellBrowser.
Public methodShellBrowser(ShellFolder) Initializes a new instance of the ShellBrowserBase class and assigns its SpecialFolder property
Public methodShellBrowser(String) Initializes a new instance of the ShellBrowser class makes the object with the given path the active object.
Top
Properties
 NameDescription
Public propertyAbsoluteItemIdList This property should only be used by advanced users. It sets or returns the absolute ItemIdList of the current object. The returned pointer to an ItemIdList will be valid, until a new object was selected.
(Inherited from ShellBrowserBase)
Public propertyStatic memberAsyncOperations Activates asynchronous file operations executed via InvokeContextMenuCommand(ShellCommand).
Public propertyDefaultSortColumn Get the default sort column of the currently selected ShellFolder.
Public propertyFileNameFormatSpecifies, whether filename are presented with file extensions or not. By default, this depends on the respective setting in Windows Explorer.
(Inherited from ShellBrowserBase)
Public propertyFileSystemOnly If FileSystemOnly is set to True, objects and virtual folders which do not have a file system path, will not be displayed. Exceptions are 'My Computer', 'Libraries' and 'Network'
(Inherited from ShellBrowserBase)
Public propertyFilter You can use a single pattern, e.g. '*.doc' or concatenate several patterns using semicolons to separate them, e.g. '*.exe;*.com'.
(Inherited from ShellBrowserBase)
Public propertyFilterFilesOnlyGets or sets a value indicating whether the Filter property applies to files only, but all folders are listed.
(Inherited from ShellBrowserBase)
Public propertyFilterRegularExpression Define a regular expression to filter the files that will be enumerated.
(Inherited from ShellBrowserBase)
Public propertyFolder Use Folder to specify the path of the folder, which should be browsed or to get the path that is currently active.
(Inherited from ShellBrowserBase)
Public propertyFolderIdList This property should only be used by advanced users. The returned ItemIdList has to be freed when it is not needed any more.
(Inherited from ShellBrowserBase)
Public propertyFullPath Gets or set the full path of the active object.
(Inherited from ShellBrowserBase)
Public propertyHasSubFolders Checks if the currently active object has subfolders.
(Inherited from ShellBrowserBase)
Public propertyIconNumber Use IconNumber to get the number of the icon for the current object.
Public propertyIsEnumerable True if the currently active object is a folder and can be browsed.
(Inherited from ShellBrowserBase)
Public propertyIsFolder Can be used to query if the currently active object is a folder or not.
(Inherited from ShellBrowserBase)
Public propertyItemIdList Returns the relative ItemIdList of the current element in this instance.
(Inherited from ShellBrowserBase)
Public propertyMultiObjects Holds a list of files that serves as selection for some operations like showing the context menu.
(Inherited from ShellBrowserBase)
Public propertyObjectName Use ObjectName to specify the current object or to retrieve the file system name of the current object. A valid folder must be set, see FullPath and SpecialFolder
(Inherited from ShellBrowserBase)
Public propertyReadOnly If set to 'true', context menu operations that make changes to the file system will not be executed.
Public propertySelectedIconNumber Use SelectedIconNumber to get the number of the 'opened' icon for the current object.
Public propertyShowErrorMessages If set to to 'true', error messages will be shown to the user. If set to 'false', error messages will be suppressed.
(Inherited from ShellBrowserBase)
Public propertyShowShellContextMenuOnTop Decides if the shell context menu is added above or below the supplied ContextMenuStrip.
Public propertySpecialFolder Get or set a special folder as the currently active folder
(Inherited from ShellBrowserBase)
Public propertySpecialObject Get or set a special object as the currently active object
(Inherited from ShellBrowserBase)
Public propertyVersion The current version of the ShellBrowser.
Top
Methods
 NameDescription
Public methodBrowseObject Makes the currently active shell object the current folder.
(Inherited from ShellBrowserBase)
Public methodCanRename Checks if the currently active object can be renamed.
(Inherited from ShellBrowserBase)
Protected methodCheckIfValid(Boolean) Checks if the current object is in a valid state for performing operations
(Inherited from ShellBrowserBase)
Protected methodCheckIfValid(Boolean, Boolean) Checks if the current object is in a valid state for performing operations
(Inherited from ShellBrowserBase)
Public methodConnectToServer Connects to a remote computer.
Protected methodDispose Releases all resources held by this instance.
(Inherited from ShellBrowserBase)
Public methodStatic memberEnsureExtension Ensures the given extension for a filename or path.
Public methodFilterMatch Checks if the currently active object matches the filter that is set.
(Inherited from ShellBrowserBase)
Public methodStatic memberFromHbitmap Converts a handle to a HBITMAP structure to an Image instance. If the size given is lesser than 256 pixels in width and height, the alpha channel is preserved.
Obsolete
Protected methodGetAttributes Checks if the given attributes apply to the current objects
(Inherited from ShellBrowserBase)
Public methodGetColumnInfo Use this function to get information about the columns, which the Explorer uses in the details view. Provides the default alignment and the default width of a column, like Explorer would use it. Use GetColumnText(Int32, Boolean) or GetColumnText(SHCOLUMNID, Boolean) to get the column title or the text for a specific column.
Public methodGetColumnText(Int32, Boolean) Returns the text to show for the currently active item in a certain column.
Public methodGetColumnText(SHCOLUMNID, Boolean) Returns the text to show for the currently active item in a certain column.
Public methodGetColumnText(SHCOLUMNID, Boolean, Object) Returns the text which would be displayed in the Details view of the Windows Explorer as String and Variant.
Public methodGetDataObject Returns the Windows Shell IDataObject interface for the currently active object wrapped into an instance of type DataObject.
Public methodGetDataObject(ItemIdList) Returns the Windows Shell IDataObject interface for the passed relative ItemIdLists wrapped into an instance of type DataObject.
Public methodStatic memberGetDefaultSavePathFromLibraryFor a given Windows 7+ library, this function returns the default save path.
Public methodGetDomain Returns the domain name of the currently active object.
(Inherited from ShellBrowserBase)
Public methodGetDragEffects Returns which drag effects are possible for the currently active object.
Public methodGetEnumerator Implemetation of IEnumerable.GetEnumerator
(Inherited from ShellBrowserBase)
Public methodGetIndexOfShColumnID Gets the shell index for a given ShColumnID.
Public methodGetInfoTip This method returns the hint text of the current object which is provided by the shell. Per default this includes information that might take some time until it is retrieved, (ie. recursively determine folder size)
Public methodGetInfoTip(Boolean) This method returns the hint text of the current object, which is provided by the shell.
Protected methodGetIShellDetails Tests if ShellFolder1.CreateViewObject succeeds. This is a prerequisite for other methods to work successfully.
(Inherited from ShellBrowserBase)
Public methodGetLastChangeDate Returns the last modified date of the currently active object.
Public methodStatic memberGetLinkTarget Returns the target a windows file link (.lnk file) is pointing to.
Public methodGetOverlayIndex Use GetOverlayIndex to get the index of the overlay icon of the current object.
Public methodGetSelectedItemIdListsGets the items the command will be executed upon.
(Inherited from ShellBrowserBase)
Public methodGetShColumnIdFromColumnNumber Returns the ShColumnID for the given shell column number.
Public methodGetShellObjectName Returns the Windows shell display name of the currently active object.
(Inherited from ShellBrowserBase)
Public methodGetThumbnailBitmap(Size) Returns the thumbnail image of the currently active shell object in the requested size.
Public methodGetThumbnailBitmap(Size, GetThumbnailCallback, Object) Asynchronously extracts the thumbnail image of the currently active shell object in the requested size. Only for folders on Vista or later the size will always be quadratic with side length being the smallest of either p_Size.Width or p_Size.Height, to avoid a stretching - use the synchronous call GetThumbnailBitmap(Size) if you'd like to explicitly specify the dimensions
Public methodGetThumbnailBitmap(Size, GetThumbnailCallback, Object, Int32) Asynchronously extracts the thumbnail image of the currently active shell object in the requested size. Only for folders on Vista or later the size will always be quadratic with side length being the smallest of either p_Size.Width or p_Size.Height, to avoid a stretching - use the synchronous call GetThumbnailBitmap(Size) if you'd like to explicitly specify the dimensions
Public methodGetThumbnailBitmap(Size, GetThumbnailCallback, Object, Int32, Boolean) Asynchronously extracts the thumbnail image of the currently active shell object in the requested size. Only for folders on Vista or later the size will always be quadratic with side length being the smallest of either p_Size.Width or p_Size.Height, to avoid a stretching - use the synchronous call GetThumbnailBitmap(Size) if you'd like to explicitly specify the dimensions
Public methodGetUIObject(Guid) Queries and returns COM interfaces from the currently active Folder and object. If object names are assigned to the MultiObject collection, then they will be used.
(Inherited from ShellBrowserBase)
Public methodGetUIObject(Guid, ItemIdList) Queries and returns COM interfaces from the currently active Folder and the given ItemIdLists.
(Inherited from ShellBrowserBase)
Protected methodGetWindowHandle Returns an approriate window handle for operations that require a window handle. It takes care that a null handle is returned to prevent error messages if ShowErrorMEssages is set to false.
(Inherited from ShellBrowserBase)
Public methodHasAttributes Checks if the given attributes apply to the current objects.
(Inherited from ShellBrowserBase)
Public methodInvokeCommandOnSelected Executes the given command on the selected items.
(Overrides ShellBrowserBaseInvokeCommandOnSelected(ShellCommand))
Public methodCode exampleInvokeContextMenuCommand Invokes the given shell command to the active object or, if not empty, to the obejct in the MultiObjects property.
Public methodInvokeContextMenuCommandOnMultiObjects Invokes the given command on multiple objects. Multiobjects needs the fullpath of these objects, if the path is different from the folder of the called ShellBrowser instance.
Public methodStatic memberIsAdmin Checks whether the user is admin or not. In Vista or later: Determines whether application is running with elevated rights (UAC) or not.
Public methodIsColumnAvailable(Int32) Checks whether the given column is available for the current folder.
Public methodIsColumnAvailable(SHCOLUMNID) Checks whether the given column is available for the current folder.
Public methodIsCompressed Checks if the currently active object is compressed.
(Inherited from ShellBrowserBase)
Public methodIsEncrypted Checks if the currently active object is encrypted.
(Inherited from ShellBrowserBase)
Public methodIsFileSystemFolder Checks if the currently active object is a file system object that can be accesses through a path.
Public methodIsHidden Checks if the currently active object is hidden.
(Inherited from ShellBrowserBase)
Public methodIsLink Checks if the currently active object is a link or shortcut.
(Inherited from ShellBrowserBase)
Public methodIsLinkToFolder Checks if the currently active object is a link/shortcut to another folder and returns the path to it.
Public methodStatic memberMatchPattern Returns true if the given string matched the wild card pattern
Public methodNext Moves on to next object in the active folder and makes it the active object. If Next has not been called before for the active folder, the first object is made active.
(Inherited from ShellBrowserBase)
Public methodNext(IShellChangeNotifier) Moves on to next object in the active folder and makes it the active object. If Next has not been called before for the active folder, the first object is made active.
(Inherited from ShellBrowserBase)
Public methodOnAfterInvokeCommandIs called after the command has been called.
(Overrides ShellBrowserBaseOnAfterInvokeCommand(ShellCommandEventArgs))
Public methodCode exampleOnBeforeInvokeCommand This method is called to trigger the BeforeShellCommand event.
(Overrides ShellBrowserBaseOnBeforeInvokeCommand(BeforeShellCommandEventArgs))
Protected methodOnContextMenuItemSelected Triggers the ContextMenuItemSelect event.
Protected methodOnRenameItemSelected Fires the RenameItemSelected event
Public methodRenameObject Renames the current object.
Protected methodReset Resets the enumeration of the items in the active folder. It can be started again using Next
(Inherited from ShellBrowserBase)
Public methodStatic memberResetFPU Resets the floating point control register to what .NET expects.
Public methodSelectParent Moves up to the parent of the current shell object
(Inherited from ShellBrowserBase)
Public methodStatic memberCode exampleSetThumbnailProvider Allows to set a callback function that can supply a thumbnail image in case the system cannot provide one.
Public methodCode exampleShowContextMenu(Point) Shows the shell context menu for the files contained in MultiObjects or the active object.
Public methodCode exampleShowContextMenu(Point, ContextMenuStrip) Shows the shell context menu for the files contained in MultiObjects or the active object, adding the context menu entries contained in pContextMenuStrip
Top
Events
 NameDescription
Public eventBeforeShellCommand This event is fired before a shell command is executed. It can be intercepted by setting Cancel to true in the event handler.
(Inherited from ShellBrowserBase)
Public eventContextMenuItemSelected This event is fired when a context menu item is selected.
Public eventRenameItemSelected This event is fired when the context menu option "Rename" is selected.
Top
Fields
 NameDescription
Public fieldStatic memberMAX_COLUMNS Max number of columns.
Top
Remarks
ShellBrowserBase is a non-visual component. The property Folder contains the path of the current folder, ObjectName contains the name of the current object. Use the method Next to enumerate the objects in the current folder. Use IsFolder to check if the current object is a folder. IconNumber contains the number of the corresponding icon of the current object in the system icon list. The method ShowContextMenu(Point) shows the context menu of the current object at a given point. You can shuffle your own popup menus together with the explorer context menu. InvokeContextMenuCommand(ShellCommand) will execute a command of the context menu, for example 'properties', 'default' or 'delete'.
See Also