ShellBrowser Delphi Components Documentation
ContentsIndexHome
Example
procedure TMainForm.JamFilePreview1LoadPreview(Sender: TObject; eventArgs: TJamFilePreviewLoadPreviewEventArgs);
begin
  // This example shows how to use the HTML preview handler for files with the extensions CSM:
  if LowerCase(ExtractFileExt(eventArgs.Path)) = '.csm' then
      eventArgs.PreviewHandlerGuid := StringToGUID('{F8B8412B-DEA3-4130-B36C-5E8BE73106AC}');

  // The following example checks the PreviewHandler that will be used, and forces the loading and unloading of such previews
  // to the GUI thread. Doing so can be a workaround for rare cases where an external previewhandler has problems when
  // being executed to a non-gui thread.

  if (eventArgs.PreviewHandlerGuid = TShellPreviewHandlerGuids.Excel) then
    eventArgs.ForceGUIThread := true;

  // The following lines of code will force the loading of thumbnails for pdf files instead of using a preview handler.
  if LowerCase(ExtractFileExt(eventArgs.Path)) = '.pdf' then
    eventArgs.LoadThumbnail := true;

  // disable the Previewhandler for .eml and .jer files, since it displays a message to download the file.
  if (UpperCase(ExtractFileExt(eventArgs.Path)) = '.EML') or
      (UpperCase(ExtractFileExt(eventArgs.Path)) = '.JER')
  then
    eventArgs.PreviewHandlerGuid := TGuid.Empty;
end;