SCIP.be
Photos/Travel
Articles
Kleinkunst
Components
Applications

Component: TscFileDrop

Version 1.1 (March 2008) - open source - Delphi VCL

By adding this small Delphi component to your form, you can accept the files which are dropped from Windows Explorer to your form. You can also specify which file extensions are allowed.

Dragging and dropping files from the Windows Explorer on your application form, can not be implemented with the standard events like OnDrag and OnDrop. You need to capture some Windows messages (WM_DROPFILES) and call some API functions like DragQueryFile and DragFinish. This component has encapsulated them all. You only have to add it to your form and implement the OnDrop event.

TscFileDrop component (Delphi VCL)

Delphi example:

procedure TFormFileDrop.FormCreate(Sender: TObject);
begin
  scFileDrop1.AllowedFileExtensions.Add('.DFM');
  scFileDrop1.AllowedFileExtensions.Add('PAS');
end;
 
procedure TFormFileDrop.scFileDrop1Drop(Sender: TObject; X, Y: Integer);
begin
  ListBoxDroppedFiles.Items.AddStrings(scFileDrop1.DroppedFiles);
  ListBoxAcceptedFiles.Items.AddStrings(scFileDrop1.AcceptedFiles);
end;

Copyrights and distribution

Download

TscFileDrop component
  • Contents: TscFileDrop component with sources (for Delphi 5, 6, 7, 2005, 2006 and 2007)
  • Version: 1.1 (2001-06-01)
  • Author: Stefan Cruysberghs
Download now