News
Photos
Articles
Components
Applications
Kleinkunst

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

  • The component is open source (Mozilla Public License 1.1) and may be freely distributed.
  • The author doesn't give a warranty for error free running of this component and he doesn't give any support.
  • See source code for history and more information about properties, methods and events.

Download

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