Interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
PROCEDURE FileIsDropped ( VAR Msg : TMessage ) ; Message WM_DropFiles ;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses
shellapi;
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject);
begin
DragAcceptFiles( Handle,True ) ;
end;
procedure TForm1.FileIsDropped ( VAR Msg : TMessage ) ;
var
hDrop : THandle ;
fName : ARRAY[0..254] OF CHAR ;
NumberOfFiles : INTEGER ;
fCounter : INTEGER ;
Names : STRING ;
begin
hDrop := Msg.WParam ;
NumberOfFiles := DragQueryFile(hDrop,-1,fName,254);
Names := '' ;
for fCounter := 1 TO NumberOfFiles DO BEGIN
DragQueryFile(hDrop,fCounter,fName,254);
// Aqui obtem-se o nome de todos os arquivos selecionados no Explorer
Names := Names + #13#10 + fName ;
end;
ShowMessage('Selecionados '+IntToStr(NumberOfFiles) + ' Nomes : ' + Names );
DragFinish ( hDrop);
end;
Assinar:
Postar comentários (Atom)
Nenhum comentário:
Postar um comentário