Gibt es einen Grund warum du das alles dynamisch lädst?
Ich hatte das mal so gemacht:
Delphi-Quellcode:
function CopyFileProgress(TotalFileSize, TotalBytesTransferred, StreamSize,
StreamBytesTransferred: LARGE_INTEGER; dwStreamNumber, dwCallbackReason,
hSourceFile, hDestinationFile, lpData: DWORD): DWORD; stdcall;
begin
Application.ProcessMessages;
if CancelCopy = True then
begin
Form1.ProgressBar1.Position := 0;
result := PROGRESS_CANCEL;
exit;
end;
case dwCallbackReason of
CALLBACK_CHUNK_FINISHED:
begin
Form1.ProgressBar1.Position := TotalBytesTransferred.QuadPart;
result := PROGRESS_CONTINUE;
end;
CALLBACK_STREAM_SWITCH:
begin
Form1.ProgressBar1.Max := TotalFileSize.QuadPart;
result := PROGRESS_CONTINUE;
end;
else
result := PROGRESS_CONTINUE;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
Cancel: PBOOL;
begin
CancelCopy := False;
Cancel := PBOOL(False);
CopyFileEx('g:\Brennen\Madonna - Erotica.mpg', 'g:\Madonna - Erotica.mpg',
@CopyFileProgress, nil, Cancel, 0);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
CancelCopy := True;;
end;
Ist meines Wissens schon alles in der Windows.pas deklariert.