ImageEn, unit iexWPD

FileIsWPDItem


Declaration

function FileIsWPDItem(const FileName: string): Boolean;


Description

Returns true if the specified path is located on an external device (using TIEPortableDevices).

Note:
 FileName can be a file or a folder
 It does not check IEF_Connected_Devices, only for paths with the ImageEn WPD prefix ("WPD:") and more loosely, Windows long filename prefix ("\\?\")


Examples

// Disable the "Copy Files To Clipboard" button for files in a WPD folder
btnCopyFiles.Enabled := not FileIsWPDItem( IEFolderMView1.Folder );

// Use TImageEnMView.OnGetLoadFilename to specify an icon to use for PDF files on removable devices (to improve performance)
procedure TForm1.IEFolderMViewGetLoadFilename(Sender: TObject; Index: Integer;
    var Filename: string);
begin
  if FileIsWPDItem( Filename ) and
     ( Uppercase( ExtractFileExt( Filename )) = '.PDF' ) then
    Filename := IncludeTrailingPathDelimiter( ExtractFilePath( Application.ExeName )) + 'MyPDFIcon.ico';
end;