Вниз
Скачать: CL | DM;

Отображение прогресса копирования   Найти похожие ветки 

 
Андрей Терехов   (2003-03-30 18:04) [0]

Подскажите как копировать файл, отображая сколько процентов скопировано на данный момент. Использовал CopyFile и SHFileOperation, до конца копирования размер конечного файла недоступен, даже если Application.ProcessMessages.

Спасибо!


 
jack128 ©   (2003-03-30 18:41) [1]

а чем ShFileOperation не нравится? Он какой то там процессбар показывает...

var ShFO : TSHFileOpStruct;
begin
ZeroMemory(@ShFO,SizeOf(ShFO));
ShFO.Wnd := HAndle;
ShFO.wFunc := FO_COPY;
ShFO.pFrom := PChar("d:\Internet"#0);
ShFO.pTo := PChar("d:\Internet1"#0);
ShFO.fFlags := 0;
ShFO.fAnyOperationsAborted := True;
ShFO.lpszProgressTitle := "Show";
if SHFileOperation(ShFO)=0 then ShowMessage("Yra")
else ShowMessage("No");

Если уж совсем никак, то можно создать pTo - файл, читать из pFrom файла мапример 1024 байта, писать в pTo файл - оторажать на форме процесс копирования - так в цикле до победного конца -)

ЗЫ хотя извращения все это


 
Slym ©   (2003-03-30 20:08) [2]

Ищи в Win32SDK по CopyFileEx-
Используя ProgressRoutine - узнаешь скопировано/из
The CopyFileEx function copies an existing file to a new file.

BOOL CopyFileEx(
LPCWSTR lpExistingFileName, // pointer to name of an existing file
LPCWSTR lpNewFileName, // pointer to filename to copy to
LPPROGRESS_ROUTINE lpProgressRoutine, // pointer to the callback function
LPVOID lpData, // to be passed to the callback function
LPBOOL pbCancel, // flag that can be used to cancel the operation
DWORD dwCopyFlags // flags that specify how the file is copied
);


Parameters

lpProgressRoutine

Specifies the address of a callback function of type LPPROGRESS_ROUTINE that is called each time another portion of the file has been copied. This parameter can be NULL. For more information on the progress callback function, see CopyProgressRoutine.



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

Скачать: CL | DM;



Память: 0.45 MB
Время: 0.011 c
14-95028
Mike Kouzmine
2003-05-13 14:04
2003.05.29
Аравийские взрывы


14-95006
MalkoLinge
2003-05-12 17:38
2003.05.29
Покритикуйте компоненту..Только того... ПО-ДОБРОМУ :)))


6-94999
grid_y
2003-03-27 10:28
2003.05.29
SMTP


7-95141
keymaster
2003-03-30 22:25
2003.05.29
Свой шрифт в программе


14-95091
Moris The Cat
2003-05-11 20:14
2003.05.29
Win98




   Наверх