Como que faço para copiar todos os arquivos de uma pasta para disquete ?Enquanto a copia for sendo feita preciso que o progressbar vá progredindo automaticamente ao tamanho dos arquivos copiados.

Usando O Progressbar Na Cópia De Arquivos
Started By Sinistro(X), 05/04/2005, 10:32
1 reply to this topic
#1
Posted 05/04/2005, 10:32
tsc naum tinha nada pra digitar aqui e hã? ...
#2
Posted 05/04/2005, 18:00
Para ter a progress bar, vc pode opcionalmente usar a própia API do Windows, usando a função abaixo:
Onde OPERACAO: 1 (Move arquivo), 2 (Copia arquivo)
Onde MODO: 5 (Aparece a janela de cópia de arquivo do windows)
Pode usar assim:
function ProcessArquivo(const Origem, Destino : string; Operacao, Modo:Integer) : Boolean; // Requer a unit ShellApi na clausula uses da unit Const Aborted : Boolean = False; var shfo : TSHFileOpStruct; begin FillChar(shfo,SizeOf(shfo),$0); with shfo do begin if Operacao > 2 then begin operacao := 2; end; if Modo > 5 then begin modo := 1; end; case operacao of 1: wFunc := FO_MOVE; 2: wFunc := FO_COPY; end; pFrom := Pchar(Origem); pTo := Pchar(Destino); case Modo of 1: fFlags := FOF_SILENT; 2: fFlags := FOF_ALLOWUNDO or FOF_FILESONLY; 3: fFlags := FOF_RENAMEONCOLLISION; 4: fFlags := FOF_NOCONFIRMATION; 5: fFlags := FOF_SIMPLEPROGRESS; end; end; Result := (SHFileOperation(shfo)= 0) and (not Aborted); end;
Onde OPERACAO: 1 (Move arquivo), 2 (Copia arquivo)
Onde MODO: 5 (Aparece a janela de cópia de arquivo do windows)
Pode usar assim:
if ProcessArquivo('C:\arquivo.avi', 'A:\arquivo.avi', 5, 2) then ShowMessage('Cópia ok') else ShowMessage('Problemas na cópia'); end if
__________________________________________
The Tamer
Quando morrer, escrevam em minha lápide: </life>
Blog: http://www.dtsoftware.eti.br/
MCWD - Macromedia Certified Web Designer MX
The Tamer
Quando morrer, escrevam em minha lápide: </life>
Blog: http://www.dtsoftware.eti.br/
MCWD - Macromedia Certified Web Designer MX
1 user(s) are reading this topic
0 membro(s), 1 visitante(s) e 0 membros anônimo(s)