ShellBrowser Delphi Components Documentation
ContentsIndexHome
Example
procedure TMainForm.ShellListBeforeShellCommand(Sender: TObject;
  const Command: string; Items: IItemIdListCollection;
  var AllowExecute: Boolean);
begin
  if Items.Count <> 1 then
    exit;
  //suppress the default action for text files. 
  if (TShellCommand(Command) in [TShellAction.saDefault, TShellAction.saOpen]) and
    (UpperCase(ExtractFileExt(Items[0].Path)) = '.TXT') then begin

    AllowExecute := false;

    //additionally you might handle the action yourself.
    ShowMessage('Custom action');
  end;
end;

//using the new BeforeCommand event
procedure TMainForm.ShellListBeforeCommand(Sender: TObject; var pCommandArgs:
    TBeforeCommandEventArgs);
begin
  //always open folder internally, instead of opening a File Explorer instance.
  if (pCommandArgs.Command = TShellAction.saOpen) and (pCommandArgs.CommandSource = TCommandSource.ContextMenu)
    and (pCommandArgs.Items.Count = 1) and (pCommandArgs.Items[0].IsFolder) then
  begin
    pCommandArgs.Cancel := true;
    ShellList.FolderIdList := pCommandArgs.Items[0];
  end;
end;