Knowledge Base

ShellBrowser Delphi Edition

All entries (Page 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 order ShellBrowser Delphi Edition and how will it be delivered?

You may order online at www.jam-software.com

For further questions, please have a look at the Shop FAQ:
www.jam-software.de/knowledgebase/customers/

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);
var
    i:Integer;
begin
    i := 0;
    while (i < ShellTree.Items.Count) do
    begin
        if (ShellTree.Items[i].AbsoluteItemIdList.SpecialFolder in [SF_FAVORITES, SF_LIBRARIES]) then
            ShellTree.Items[i].Expand(False);
        Inc(i);
    end;
end;

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

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


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

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

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

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: http://forum.codecall.net/topic/69184-solved-file-association-and-the-registry/

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:
ShellList.Selected.IsFolder;

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).