ImageEn, unit iexWindowsFunctions

PasteFilesFromClipboard


Declaration

function PasteFilesFromClipboard(Handle: HWND; ssFilenames: TStrings; out bMoveFiles : Boolean) : Boolean;
function PasteFilesFromClipboard(Handle: HWND; const sDestFolder : String; bRenameOnCollision, bShowConfirmation, bShowProgress: boolean; bVerboseErrors : boolean = True): Boolean; overload;


Description

Handles pasting of files from the clipboard that have been copied from Windows Explorer or TImageEnFolderMView.
Can specify 0 for Handle.

With First overload, files are not moved or copied, but only as assigned to ssFilenames. bMoveFiles will be true if they are marked to be moved (i.e. Ctrl+X was used instead of Ctrl+V).
With Second overload, files will be actually moved or copied to the destination folder.
Parameter Description
bSendToRecycleBin Moves the file to the Recycle Bin rather than permanently deleting it (pertains to FOF_ALLOWUNDO
bShowConfirmation If not specified then will automatically respond with "Yes to All" for any dialog box that is displayed (undefines FOF_NOCONFIRMATION
bShowProgress Displays a progress dialog box (undefines FOF_SILENT
bVerboseErrors Displays a dialog to the user if an error occurs (undefines FOF_NOERRORUI

Result is true if there are files on the clipboard


Examples

// First overload
bHaveFiles := PasteFilesFromClipboard(Form1.Handle, ssFilenames, bMoveFiles);
if bHaveFiles then
  ShowMessage('No Files to paste')
else
if bMoveFiles  then
  ShowMessage('Files to Move:' + #13#10 + ssFilenames.Text)
else
  ShowMessage('Files to Copy:' + #13#10 + ssFilenames.Text);
// Now you actually need to move or copy the files

// Second overload - will handle whole process
bHaveFiles := PasteFilesFromClipboard( Form1.Handle, 'C:\My Folder, bMoveFiles, True, True, True );