FO_COPY
FO_DELETE
FO_MOVE
FO_RENAME
Note: The buffer that contains the file names to copy must end with a double null terminating character
The following example copies three files to 'e' drive.
uses ShellAPI;
procedure TForm1.Button1Click(Sender: TObject) ;
var
Fos : TSHFileOpStruct;
Buf : array[0..4096] of char;
p : pchar;
sDest : string;
begin
FillChar(Buf, sizeof(Buf), #0) ;
p := @buf;
p := StrECopy(p, 'C:\FirstFile.ext1') + 1;
p := StrECopy(p, 'C:\SecondFile.ext2') + 1;
StrECopy(p, 'C:\ThirdFile.ext3') ;
sDest := 'e:\';
FillChar(Fos, sizeof(Fos), #0) ;
with Fos do
begin
Wnd := Handle;
wFunc := FO_COPY;
pFrom := @Buf;
pTo := sDest;
fFlags := 0;
end;
if ((SHFileOperation(Fos) <> 0) or (Fos.fAnyOperationsAborted <> false)) then ShowMessage('Cancelled')
end;
Delphi tips navigator:
» Long ListBox entries as hints
« Capture the output from a DOS (command/console) Window

