Knowledge Base

ShellBrowser .NET Edition

All entries

I 'd like to retrieve the target of a link when I use the ShellBrowser component, could a method be added for this (currently it 's only possible to retrieve it if it 's a folder)?

Since version 3.0.2 of the ShellBrowser components it is now possible to retrieve the target of a windows shortcut link. Just call the static methodstring ShellBrowser.GetLinkTarget(string shortcut);>and it will resolve the link. If it is not a link file (ie. a normal file or folder) it will return the empty string "", and null on error.

Checkboxes.I have at very big problem that clicking checkboxes in a ShellFileList the first time is extremely slow and the next time completely freezes my application.Is there any explaination for this behaviour ?

For folders containing many files and subfolders the process of collecting
file information (e.g. overall size) can take a while. If you 'd like to suppress
the scan you can set the CalculateSelectedFiles property in the SelectionList
to false.
Here is an example on how it would look like for the JamExplorer application:private void recursivelyScanSelectedToolStripMenuItem_Click(object sender, EventArgs e)
{
?? ?//switch the calculation mode:
?? ?shellControlConnector1.SelectionList.CalculateSelectedFiles ^= true;

?? ?recursivelyScanSelectedToolStripMenuItem.Checked =
?? ??? ?shellControlConnector1.SelectionList.CalculateSelectedFiles;
}

I 'm having some trouble with the ShellListView, is seems that the SelectedFiles property is not updated when I selected different files with the mouse.

A multiselection is not updated in the SelectedFiles property.
This is a known bug in Shellbrowser v.3.1.1 which will be corrected in the next release.
As a workaround, you could do the following:
Get the SelectedItemsCollection it contains ShellListItem instances. This is also useful to determine wether the User selected a File or Folder.

ListView.SelectedListViewItemCollection itemCollection=
shellListView1.SelectedItems;
foreach (object o in itemCollection) {
??? ShellListItem shellItem = o as ShellListItem;
??? if (shellItem!=null) {
??????? path = shellItem.FullPath;
??? }
}

Is there a way to set the path that the tree displays? I want to show a particular folder when the tree initializes.

You can either set a special windows folder by setting the RootedAt property: this.shellTreeView1.RootedAt = Jam.Shell.ShellFolder.Desktop;

Or at your option, you can specify a system path the ShellTreeView component will display this>.shellTreeView1.RootedAtFileSystemFolder = @"c:\windows"

How do I make a context menu work with the ShellListView or ShellTreeView?I 'm using VB2005 and have created a contextmenu. I 've set it as the contextmenu for the Menu, the ShellHistoryToolStrip, List and Tree views.When I right click on the menu, HistoryToolStrip, or the blank space inthe List or Tree views, the menu displays.When I right click on a file or folder, the regular Windows Explorer context menu appears without having merged mine.What have I done wrong?

Before version 3.0.2 it was necessary to set the hidden property "ContextMenu" to the contextmenu that should be merged with the shell context menu.From version 3.0.2 of Shellbrowser the ContextMenuStrip property is supported. It is converted to a ContextMenu instance which is a Wrapper of the Windows Shell-API and therefore can be merged with the menu provided by the operating system, including the extensions of third-party applications.The OnOpening and OnClosing events are mapped to the Popup/Collapse events respectively. Other events provided by ContextMenuStrip are not triggered.A menuitem of course provides the OnClick event.Furthermore, a new property "BackgroundContextMenu" has been introduced for the ListViews of ShellBrowser. It is displayed if the user clicks the right mouse button without having an item selected. A real ToolStripMenu instance can be used here with all events that it supports. It is however recommended to set the RenderMode property to "System" to keep the look & feel consistent with the shell context menu.