Question and Answer Database FAQ2118D.txt Copying files using the Standard Windows Copy file dialog box Category :Windows API Platform :All Product :All 32 bit Question: Is there any way to copy a group of files and use the same file copy animation dialog box that the Windows Explorer uses? Answer: 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. TO_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; Example: uses ShellAPI; procedure TForm1.Button1Click(Sender: TObject); var Fo : TSHFileOpStruct; buffer : array[0..4096] of char; p : pchar; begin FillChar(Buffer, sizeof(Buffer), #0); p := @buffer; p := StrECopy(p, 'C:\DownLoad\1.ZIP') + 1; p := StrECopy(p, 'C:\DownLoad\2.ZIP') + 1; p := StrECopy(p, 'C:\DownLoad\3.ZIP') + 1; StrECopy(p, 'C:\DownLoad\4.ZIP'); FillChar(Fo, sizeof(Fo), #0); Fo.Wnd := Handle; Fo.wFunc := FO_COPY; Fo.pFrom := @Buffer; Fo.pTo := 'D:\'; Fo.fFlags := 0; if ((SHFileOperation(Fo) <> 0) or (Fo.fAnyOperationsAborted <> false)) then ShowMessage('Cancelled') end; 7/16/98 4:31:28 PM
Last Modified: 01-SEP-99