{******************************************************************************} { Delphi Component "FileCopy" } { Author: Robert Palomo } { } { This component is Freeware. It is distributed "as is" with no guarantees } { of any kind. You may redistribute the component and/or source code provided } { you include this notice in any distribution (modified or otherwise of the } { source code. } {******************************************************************************} -------- Overview -------- This is a component based on the function CopyFile in Borland's FMXUTILS unit. It simply copies a file from source path to destination path. I found I was always needing that functionality from FMXUTILS, so I just wrapped it up in this component with a few additional properties and event handlers (see Usage below). It's probably not the best implemenation possible, but it was fast it works for what I need. I did it with Delphi 6 but it should work with earlier versions and Delphi 7. ------------------------ Installation (Delphi 6) ------------------------ 1. Unzip the distribution archive into Delphi 'Lib' folder 2. Start Delphi 3. Choose Component | Install Component 4. In the Install Component dialog, choose the tab Into Existing Package 5. In Unit File field, Browse to and select the file [DelpiHome]\Lib\FileCopy.pas (Borland user components) 6. In Package File field, select [DelpiHome]\Lib\dclusr.dpk ----- Usage ----- Set these public properties in your code: 'SourceFile' (path of file to be copied) 'TargetFile' (path of file to be written) Call method: 'Execute' to copy SourceFile to TargetFile. Set published property 'OverWritePrompt' to control if user gets prompted before overwriting existing files. By default the value is True (user will be prompted to confirm overwrites). There are 2 events for which you can write handlers: 'BeforeExecute': specify any processing to occur before the file copying takes place 'AfterExecute': specify any processing for after the file copying process, if there was no error.