|
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
TForm1 = class (TForm)
procedure FormCreate (Sender: TObject);
private
procedure WMDRopFile (var Message: TWMDropFiles); Message WM_DROPFILES;
public
{Public declarations}
end;
var
Form1: TForm1;
implementation
uses
ShellApi;
{$ R * .dfm}
{TForm1}
procedure TForm1.WMDRopFile (var Message: TWMDropFiles);
var
NumFiles: integer;
buffer: array [0..255] of char;
i: integer;
begin
NumFiles: = DragQueryFile (Message.Drop, $ FFFFFFFF, nil, 0);
for i: = 0 to NumFiles-1 do
begin
DragQueryFile (Message.Drop, i, buffer, sizeof (buffer));
// Buff is the file name
Self.Canvas.TextOut (0, i * 20, Buffer);
end;
end;
procedure TForm1.FormCreate (Sender: TObject);
begin
DragAcceptFiles (Handle, true);
end;
end. |
|