Knowledge Base

ShellBrowser Delphi Components

Geben Sie bitte einen Suchbegriff ein oder wählen Sie eine der obenstehenden Kategorien aus.

Alle Einträge (Seite 1 / 5)

I can drag files from JamExplorer to the Windows Explorer, but not the other way round. What is going wrong?

Privileged processes do not receive Drag&Drop from non-privileged processes for security reasons. This could be the case if you start your IDE or your executable as admin.

How can I expand nodes like SF_FAVORITES or SF_LIBRARIES in the JamShellTree?

To expand these nodes, you may use code like this:

procedure TMainForm.FormShow(Sender: TObject);
    i := 0;
    while (i < ShellTree.Items.Count) do
        if (ShellTree.Items[i].AbsoluteItemIdList.SpecialFolder in [SF_FAVORITES, SF_LIBRARIES]) then

How can I forbid entering a specific folder in a JamShellTree and JamShellList?

You can use the TJamShellTree.OnChanging event like this:
uses ShellBrowser;
    forbiddenPath: String = 'C:\Windows';
procedure TMainForm.ShellTreeChanging(Sender: TObject; Node: TTreeNode; var AllowChange: Boolean);
    shellNode: TJamShellTreeNode;
    shellNode := node as TJamShellTreeNode;
    if (ShellBrowser.SamePath(shellNode.FullPath, forbiddenPath)) then
        AllowChange := false;

To achieve the same result in the JamShellList, use the TJamShellList.PathChanged event:
uses ShellBrowser;

    lastPath: String;
    forbiddenPath: String = 'C:\Windows';

procedure TMainForm.ShellListPathChanged(Sender: TObject);
    if (ShellBrowser.SamePath(ShellList.Path, forbiddenPath)) then
        ShellList.Path := lastPath
        lastPath := ShellList.Path;

You can also use the OnBeforeShellCommand event and use the AllowExecute parameter to prevent the execution. The Command parameter when opening a folder might be "default" or "open".

How can I exclude a drive from the JamShellTree?

You can use the OnAddFolder event with a statement like this:
CanAdd := not (GetDriveType(PChar(Path)) in [DRIVE_REMOVABLE]);

This will exclude the floppy drive. It is also possible to exclude other drives like the CD-ROM (DRIVE_CDROM).

Why do the thumbnails have an ugly black background?

The thumbnail images show a black background if your application does not include a proper XP manifest. Windows then loads the old Windows 2000 version of ComCtl32.DLL which cannot deal properly with alpha channels.
To solve this please include the unit "XpMan" somewhere in your project or set "Project > Options > Application > Runtime Themes" to the value "Enable runtime themes".

How do I change the icon of a specific file type in the JamShellList?

If the new icon is also part of the system image list, then this can be easily achieved using the OnGetImageIndex event of the JamShellList. You can get the full name and path of a specific item in the list using the GetFullPath method.
To get the index of a specific file type icon, you can use the GetIndexFromExtension method of the TJamSystemImageList component.

Since the system image list is a global resource that is shared among all applications it cannot be changed easily. To add your custom icon to this image list you must register a file extension (a dummy one if necessary) with your icon in the system. This is done via the registry. Have a look here on the respective keys and how to manipulate them in Delphi:

Note: Many installation builders can register icons for a specific file extension, e.g. InnoSetup

When I read the file name of the currently selected file in a JamShellList from the Selected.Caption property, the file extension is missing if the user has set the according option in the Windows Explorer options. How can I get the full file name?

You can use the SelectedFiles property to get a list of all currently selected file including their extension. The path of the currently displayed directory can be read from the Path property.

How can I find out if an item in the TJamShellList is a directory?

You can use a statement like this:

How can I emulate the "One-Click" behaviour of the Windows Explorer in the TJamShellList?

1. Set the HotTrack property to True
2. Set the values htHandPoint and htUnderLineCold in the HotTrackStyles also to True.
3. Enter the following line to the OnMouseUp event of the JamShellList: JamShellList.InvokeCommandOnSelected('default');

How can I prevent a file from being opened in the TJamShellList?

Assign the OnKeyDown event with this content:
if Key = vk_Return then Key := 0;

To prevent the automatic handling of a double click, simply add an OnDblClick event handler.

How can I exclude a drive from the list?

You can use the OnAddItem event to exclude e.g. the floppy drive like this:

CanAdd := not (GetDriveType(PChar(JamShellList.GetFullPath(Item))) in [DRIVE_REMOVABLE]);

This will exclude the floppy drive. It is also possible to exclude other drives like the CD-ROM (DRIVE_CDROM).

How do I get the check status of an item?