Search results for 'StrECopy'. 1 post(s) found.

  1. 2007/09/19 Copying Group of Files using Delphi with Standard Animation Dialog (SHFileOperation)
2007/09/19 08:17

Copying Group of Files using Delphi with Standard Animation Dialog (SHFileOperation)


The following example demonstrates using the SHFileOperation function to copy a group of files and display a progress dialog. You can also use the following flags to delete, move and rename a group of files.

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;

Trackback 3 Comment 0

Trackback : Cannot send a trackbact to this post.

  1. Subject different money making ideas

    Tracked from moneyideas 2010/01/29 01:43 delete

    moneyideas

  2. Subject different money making ideas

    Tracked from moneyideas 2010/01/29 09:48 delete

    moneyideas

  3. Subject different money making ideas

    Tracked from moneyideas 2010/01/31 16:40 delete

    moneyideas