Показать сообщение отдельно
  #4  
Старый 20.07.2006, 13:52
Аватар для Decoding
Decoding Decoding вне форума
Местный
 
Регистрация: 03.06.2006
Адрес: Почту найдете на моем сайте
Сообщения: 576
Версия Delphi: D10.2
Репутация: 214
По умолчанию

Ну не знаю, я проверил твой код, все работает отлично.

Код:
function CopyDir(const fromDir, toDir: string): Boolean;
var
  fos: TSHFileOpStruct;
begin
   ZeroMemory( @fos, SizeOf( fos ) );
   with fos do
   begin
      wFunc := FO_COPY;
      fFlags := FOF_FILESONLY;
      pFrom := PChar(fromDir + #0);
      pTo := PChar(toDir)
   end;
   Result := ( 0 = ShFileOperation( fos ) );
end;


procedure TForm1.Button1Click(Sender: TObject);
var
  j: integer;
  List: TStringList;
begin
   List := TStringList.create;
   List.Add( 'D:\Program Files\Borland\Delphi6\Source\Clx' );
   List.Add( 'D:\Program Files\Borland\Delphi6\Source\Indy' );
   List.Add( 'D:\Program Files\Borland\Delphi6\Source\Rtl' );
   List.Add( 'D:\Program Files\Borland\Delphi6\Source\Vcl' );
   for j := 0 to List.Count-1 do
      if CopyDir( List.Strings[j], 'C:\' ) then
         ShowMessage( 'файлы скопированы' );
end;
Ответить с цитированием