procedure TfrmMain.WMDROPFILES(
var Msg: TMessage);
var found : TStrings;
i : Integer;
j : Integer;
anzahl : Integer;
size : Integer;
Dateiname : PChar;
function IsFile(filename :
String) : Boolean;
begin
Result := FileExists(Filename);
end;
function IsDirectory(dir :
String) : Boolean;
begin
Result := DirectoryExists(Dir+'
\');
end;
function IsVolume(
const name : WideString) : Boolean;
var VolName : WideString;
DType : Cardinal;
begin
if (
Name = '
')
then
begin
Result := False;
Exit;
end;
if Name[Length(
Name)] <> PathDelim
then
VolName :=
Name + PathDelim
else
VolName :=
Name;
DType := GetDriveTypeW(PWideChar(
Name));
Result := DType <> DRIVE_NO_ROOT_DIR;
end;
begin
inherited;
anzahl := DragQueryFile(Msg.WParam, $FFFFFFFF, Dateiname, 255);
for i := 0
to (anzahl - 1)
do
begin
size := DragQueryFile(Msg.WParam, i ,
nil, 0) + 1;
Dateiname := StrAlloc(size);
if IsDirectory(Dateiname)
then
begin
ST := TSearchTool.Create;
with ST
do
begin
ST.SetFilter('
*.*');
if frmOp.Rek
then
ST.Recurse := True
else
ST.Recurse := False;
MHandle :=
Handle;
MCurrentDir := mkNoneMessage;
if ST.IsSearching
then
begin
ST.Break;
end else
begin
LastAdded := 0;
ST.SearchFiles(Dateiname);
for j := 0
to found.Count - 1
do
DragQueryFile(Msg.WParam, i , PChar(found[j]), size);
found.Free;
end;
Free;
end;
end else
if IsVolume(Dateiname)
then
begin
MsgBox('
Volumes are not supported.')
end else
if IsFile(Dateiname)
then
begin
DragQueryFile(Msg.WParam,i , Dateiname, size);
end;
AddSingleFile(StrPas(Dateiname));
StrDispose(Dateiname);
end;
DragFinish(Msg.WParam);
end;