
31.10.2008, 17:26
|
Модератор
|
|
Регистрация: 17.04.2008
Сообщения: 8,100
Версия Delphi: 7, XE3, 10.2
Репутация: 49089
|
|
Обработка сообщения WM_DROPFILES, кажется.
Код:
public
{ Public declarations }
procedure CreateParams(var Params: TCreateParams); override;
procedure WMDropFiles(var Message: TWMDropFiles); message WM_DROPFILES;
...
procedure TMainForm.CreateParams(var Params: TCreateParams);
begin
inherited CreateParams(Params);
Params.ExStyle := Params.ExStyle or WS_EX_ACCEPTFILES;
end;
procedure TMainForm.WMDropFiles(var Message: TWMDropFiles);
var
I : Integer;
FileCount : Integer;
FileName : Array [0..255] of Char;
begin
inherited;
FileCount := DragQueryFile(Message.Drop, $FFFFFFFF, Nil, 0); // how many files are dropped
For I := 0 to FileCount - 1 Do // for all the file in the list
Begin
DragQueryFile(Message.Drop, I, FileName, 256); // get the FileName (max characters 255 + #0)
If FileExists(FileName) Then
Begin
// Add your code here...
End;
End;
DragFinish(Message.Drop); // Free resources
end;
|