Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2005.02.06;
Скачать: CL | DM;

Вниз

Копирование папки   Найти похожие ветки 

 
Progh   (2004-12-17 10:25) [0]

Копирую папку ф-ией :

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;

Все копируется отлично, но при копировании появляется стандартный Windows-овский диалог копирования, как мне убрать этот диалог копирования, чтобы все копирование происходило в фоновом режиме ?


 
Antoha ©   (2004-12-17 10:46) [1]

Ты вызываешь WinApi функцию, а конкретнее функцию шела или explorer"a. Дак вот если не хочешь чтобы окошко вылазило пиши свою функцию копирования каталога.


 
Fay ©   (2004-12-17 10:54) [2]

FOF_SILENT ?


 
Progh   (2004-12-17 11:06) [3]


>  [2] Fay ©   (17.12.04 10:54)
> FOF_SILENT ?


Спасибо, помогло, а можно ли еще убрать диалог с вопросом: Данный папка или файл уже существует, заменить или нет .. ?

Вобщем нужно чтобы он у пользователя не спрашивал заменить или нет, а просто сам заменял и все без вопросов ...


 
Fay ©   (2004-12-17 11:08) [4]

FOF_ALLOWUNDO  Preserve Undo information, if possible. If pFrom does not contain fully qualified path and file names, this flag is ignored.  
FOF_CONFIRMMOUSE Not currently used.
FOF_FILESONLY  Perform the operation on files only if a wildcard file name (*.*) is specified.  
FOF_MULTIDESTFILES  The pTo member specifies multiple destination files (one for each source file) rather than one directory where all source files are to be deposited.  
FOF_NOCONFIRMATION  Respond with "Yes to All" for any dialog box that is displayed.  
FOF_NOCONFIRMMKDIR  Do not confirm the creation of a new directory if the operation requires one to be created.  
FOF_NO_CONNECTED_ELEMENTS Version 5.0. Do not move connected files as a group. Only move the specified files.  
FOF_NOCOPYSECURITYATTRIBS Version 4.71. Do not copy the security attributes of the file.
FOF_NOERRORUI  Do not display a user interface if an error occurs.  
FOF_NORECURSION Only operate in the local directory. Don"t operate recursively into subdirectories.
FOF_RECURSEREPARSE Recurse into reparse points. The default is to not recurse.  
FOF_NORECURSEREPARSE Treat reparse points as objects, not containers. You must set _WIN32_WINNT to 5.01 or later to use this flag. See Shell and Common Controls Versions for further discussion of versioning.  
FOF_RENAMEONCOLLISION  Give the file being operated on a new name in a move, copy, or rename operation if a file with the target name already exists.  
FOF_SILENT  Do not display a progress dialog box.  
FOF_SIMPLEPROGRESS  Display a progress dialog box but do not show the file names.  
FOF_WANTMAPPINGHANDLE  If FOF_RENAMEONCOLLISION is specified and any files were renamed, assign a name mapping object containing their old and new names to the hNameMappings member.
FOF_WANTNUKEWARNING Version 5.0. Send a warning if a file is being destroyed during a delete operation rather than recycled. This flag partially overrides FOF_NOCONFIRMATION


 
Progh   (2004-12-17 11:12) [5]


>  [4] Fay ©   (17.12.04 11:08)


fflags:=fflags or FOF_SILENT or FOF_NOCONFIRMATION

Не спрашивает, и не заменяет ... А флага заменять нет ...


 
Anatoly Podgoretsky ©   (2004-12-17 11:26) [6]

А это по твоему что FOF_NOCONFIRMATION


 
Progh   (2004-12-17 11:28) [7]


>  [6] Anatoly Podgoretsky ©   (17.12.04 11:26)
> А это по твоему что FOF_NOCONFIRMATION


Этот флаг указывает, чтобы не выводилось никаких сообщений, сообщения не выводятся, но и папка не заменяется, а мне нужно чтобы сообщение не выводилось, но и файлы заменялись новыми копиями ...


 
Fay ©   (2004-12-17 11:37) [8]

Напиши свою функцию - будет делать что захочешь


 
Anatoly Podgoretsky ©   (2004-12-17 19:45) [9]

Сильно ошибаешься, прочитай еще раз справку.


 
DelphiN! ©   (2004-12-18 08:15) [10]

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



Страницы: 1 вся ветка

Текущий архив: 2005.02.06;
Скачать: CL | DM;

Наверх




Память: 0.49 MB
Время: 0.028 c
6-1100790430
Vika_cc
2004-11-18 18:07
2005.02.06
IdSMTP


4-1103567201
_snake_
2004-12-20 21:26
2005.02.06
Разница между RS422 и RS232


1-1106228591
tse
2005-01-20 16:43
2005.02.06
Сжатие масива данных


14-1105429185
leonidus
2005-01-11 10:39
2005.02.06
Не открываются chm-файлы


3-1104832769
Roter
2005-01-04 12:59
2005.02.06
Проблема вычитки identity полей из БД