手头没有NT,大概是这样的。。。<br>unit Unit6;<br><br>interface<br><br>uses<br> Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,<br> Dialogs, StdCtrls;<br><br>const<br> WM_COPYFILE = WM_USER + 1;<br><br>type<br> TForm1 = class(TForm)<br> Button1: TButton;<br> Label1: TLabel;<br> procedure Button1Click(Sender: TObject);<br> private<br> procedure WMCOPYFILE(var Msg: TMessage); message WM_COPYFILE;<br> public<br> { Public declarations }<br> end;<br><br>var<br> Form1: TForm1;<br><br>implementation<br><br>{$R *.dfm}<br>function CopyProgress(<br> TotalFileSize : LARGE_INTEGER; // total file size, in bytes<br> TotalBytesTransferred : LARGE_INTEGER; // total number of bytes transferred<br> StreamSize : LARGE_INTEGER; // total number of bytes for this stream<br> StreamBytesTransferred: LARGE_INTEGER; // total number of bytes transferred for this stream<br> dwStreamNumber : DWORD; // the current stream<br> dwCallbackReason : DWORD; // reason for callback<br> hSourceFile : THANDLE; // handle to the source file<br> hDestinationFile : THANDLE; // handle to the destination file<br> lpData : Pointer // passed by CopyFileEx<br> ) : DWORD; stdcall;<br>var<br> S : String;<br>begin<br> S := Format('%08X:%08X of %08X:%08X copied./', [TotalBytesTransferred.HighPart,TotalBytesTransferred.LowPart,TotalFileSize.HighPart,TotalFileSize.LowPart]);<br> PostMessage(Form1.Handle, WM_COPYFILE, 0, Integer(PChar(S)));<br> Result := PROGRESS_CONTINUE;<br>end;<br><br>procedure TForm1.WMCOPYFILE(var Msg: TMessage);<br>begin<br> Label1.Caption := PChar(Msg.LParam);<br>end;<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>var<br> Cancel : Bool;<br> Src, Dest : String;<br>begin<br> Cancel := False;<br> Src := 'c:/yyy';<br> Dest:= 'c:/xxx';<br> CopyFileEx(PChar(Src), PChar(Dest), @CopyProgress, nil, @Cancel,COPY_FILE_FAIL_IF_EXISTS)<br>end;<br><br>end.<br>