Windows with Delphi Windows API (94) Windows Filesystem (41) Windows Forms (69) Windows Graphics (38)
Exchange Links About this site Links to us 
|
Drag and Drop from FileManager
This article has not been rated yet. After reading, feel free to leave comments and rate it.
You need to use these 3 functions from the ShellApi:
- DragAcceptFiles - registers whether a window accepts dropped files
- DragQueryFile - retrieves the filename of a dropped file
- DragFinish - releases memory allocated for dropping files
 | |  | |
uses
ShellApi;
..
procedure TForm1.FormCreate(Sender: TObject);
begin
DragAcceptFiles(Form1.Handle, true);
Application.OnMessage := AppMessage;
end;
| |  | |  |
Notes:
- When dropping files, the DroppedFilename is the complete path, not just the filename.ext
- It is possible to drag and drop just a directory. So if you are expecting filenames, you have to check for existence yourself.
- The filenames come in uppercased.
Comments:
|