TDropFile Component:

About TDropFile
TDropFile is a non-visual component for the Delphi 2.0 VCL. When added to a form, it will support file drag-and-drop from Explorer. Multiple files may be dropped. If the application is launched by dragging files onto its icon, the OnDropFile event will be fired when the application’s form is activated for the first time.*

* Note. This is done by examining the command line parameters. Unfortunately, this presents the filenames in standard DOS format, not Windows 95 long file names. I am working on a solution to this.

Installation
Add the dropfile.dcu & dropfile.dcr files to the Component Library. TDropFile is added to the Samples page of the palette.

Properties
The standard properties Name and Tag are published (i.e. appear in the Object Inspector). In addition, the Active property is provided, to enable/disable accceptance of dropped files. 

Two other properties are provided; both are run-time and read-only:

DropCount: Integer;
Contains the number of files dropped on the form.

FileList: TstringList;
Contains the names of the dropped files.

Events
One event is published:

OnDropFile
This is triggered when one or more files are dropped on the form containing the TDropFile component.

Using TDropFile - Example
Start a new project. Place a TDropFile and a TListBox component onto the default form. Set the ListBox ALIGN property to alClient, and adjust the font size to allow for long file names. Double-click the TDropFile component, or select the OnDropFile event in the Object Inspector. Add the following code to this event's handler:

ListBox1.Items := DropFile1.FileList; {To replace list}

				or

ListBox1.Items.AddStrings(DropFile1.FileList); {To append}

Run the project, and select and drag/drop some files from the Explorer. The file names will be displayed in the ListBox, one per line. 

Note that FileList is a TStringList; using the DropCount property, you may process each line individually, for use in print or delete utilities, for instance.

Changes since v1.0

* Now 32-bit for Delphi 2.

* Long file names (except on launch - see About... above)

* Added the Active property.

* Added handling of launch by dropping files on application icon.

* Internal message handling re-written - now far more efficient.

The Author
TDropFile was written by John Tait-Doak, Dublin, Ireland. 
E-Mail to johntait@iol.ie or to CompuServe account 100420,2764