05.10.2010, 15:30
|
|
Let Me Show You
|
|
Регистрация: 30.04.2010
Адрес: Северодвинск
Сообщения: 5,426
Версия Delphi: 7, XE5
Репутация: 59586
|
|
Код:
unit Unit1;
interface
uses
ShellAPI,
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
ListBox1: TListBox;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
procedure WMDROPFILES(var Msg: TMessage); message WM_DROPFILES;
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
DragAcceptFiles(Handle, True);
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
DragAcceptFiles(Handle, False);
end;
procedure TForm1.WMDROPFILES(var Msg: TMessage);
var
Drop: HDROP;
buf: array [0..255] of Char;
i, cnt: integer;
begin
Drop:=Msg.WParam;
cnt:=DragQueryFile(Drop, $0ffffffff, @buf, SizeOf(buf));
for i:=0 to cnt-1 do
ListBox1.Items.Add(Copy(buf, 1, DragQueryFile(Drop, i, @buf, SizeOf(buf))));
DragFinish(Drop);
end;
end.
__________________
Пишу программы за еду.
__________________
|