Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "WinAPI";
Текущий архив: 2005.02.06;
Скачать: [xml.tar.bz2];

Вниз

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

 
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 вся ветка

Форум: "WinAPI";
Текущий архив: 2005.02.06;
Скачать: [xml.tar.bz2];

Наверх





Память: 0.48 MB
Время: 0.035 c
9-1099502958
FRick
2004-11-03 20:29
2005.02.06
GLScene + скрипты!


9-1099264534
Кто---то
2004-11-01 02:15
2005.02.06
Как в GLScene сделать рамочку выделения области ? Как в Фотошопе


14-1105947803
NewDelpher
2005-01-17 10:43
2005.02.06
Регистрация печатных изданий


1-1106299821
Глюк111
2005-01-21 12:30
2005.02.06
окно, вызываемое методом ShowModal не получает фокуса


4-1103456415
ship
2004-12-19 14:40
2005.02.06
ошибки приёма в com порт





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский