Search results for 'SHFileOperation'. 1 post(s) found.
2007/09/19 08:17
Copying Group of Files using Delphi with Standard Animation Dialog (SHFileOperation)
2007/09/19 08:17 in Delphi

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;
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;
Another posts included in "Delphi"
| Create new program group in the Start menu (0) | 2007/09/19 |
| Detecting and preventing Windows shut down (0) | 2007/09/19 |
| Detecting Drive Types (0) | 2007/09/19 |
| Controling sound volume from code (0) | 2007/09/19 |
| How to Close Another Application by Windows Caption (0) | 2007/09/19 |
| How to Change the Windows Start button bitmap (0) | 2007/09/19 |
| How to capture the output from a DOS (command/console) Window (0) | 2007/09/19 |
| How to Activate/Deactivate the Screen Saver (0) | 2007/09/19 |
Trackback : Cannot send a trackbact to this post.
-
Subject different money making ideas
2010/01/29 01:43
moneyideas
-
Subject different money making ideas
2010/01/29 09:48
moneyideas
-
Subject different money making ideas
2010/01/31 16:40
moneyideas
Prev

Rss Feed