TFileCopy is a component designed for very fast filecopy without
external, coarse calls involving the O.S. Furthermore it sends the percentages of read and written blocks to the calling form (by the API SendMessage). If two TProgressBar (Delphi 3.0) components (or any other component like that) are used the progress can be visually shown during the copy. The method handling the message must use the WM_FILECOPY predefined constant declared inside FileCopy.pas. Every time the message is received, wParam contains the read percentage and lParam the written percentage. For reading and writing low-level calls to FileRead and FileWrite have been used to avoid the error generated by the reset standard procedure on opening read-only files like from a CD-ROM. Properties : Name ShowOverwrite SourceFile Tag TargetFile * Name . . .
Method : ExecCopy * ExecCopy just starts the copy. This is an example of the message handling method on the calling form : procedure TForm1.WMFileCopy(var Msg : TMessage);
ProgressFrom and ProgressTo are two TProgressBar components. If you don't declare any method handling the message, TFileCopy works
*** First problem FileCopy.DCR is compiled with Delphi 1.0 so it doesn't work with the
following
*** Second problem The constant wm_filecopy is coded as := wm_user + 7777.
|