unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ShellAPI, Grids, StdCtrls;
type
TForm1 = class(TForm)
lb: TListBox;
Memo1: TMemo;
Button1: TButton;
Button2: TButton;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
procedure WMDropFiles(var M: TMessage); message WM_DROPFILES;
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
var
CountFiles: integer;
SizeName: integer;
cch: integer;
var
hDrop: integer;
Point: TPoint;
lpszFile: PChar;
{$R *.DFM}
procedure TForm1.WMDropFiles(var M: TMessage);
var
i: integer;
begin
hDrop := M.WParam;
DragQueryPoint(hDrop, Point);
CountFiles := DragQueryFile(hDrop, $FFFFFFFF, nil, cch);
for i := 0 to CountFiles - 1 do
begin
SizeName := DragQueryFile(hDrop, i, nil, cch);
GetMem(lpszFile, SizeName + 1);
DragQueryFile(hDrop, i, lpszFile, SizeName + 1);
lb.Items.Add(lpszFile);
FreeMem(lpszFile, SizeName + 1);
end;
DragFinish(hDrop);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
DragAcceptFiles(Handle, True);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
lb.Items.Clear;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
ShellAbout(Handle, 'Anton Saburov', 'APSystems', 0);
end;
end.
|