hmm sorry - verwende diesen Code.
in der OnCreate
steht noch das DragAcceptFiles(Form1.Handle, True);
Delphi-Quellcode:
interface
procedure WMDROPFILES(var Msg: TMessage);
implementation
procedure TForm1.WMDROPFILES(var Msg: TWMDropFiles);
var
pcFileName: PChar;
i, iSize, iFileCount: integer;
begin
pcFileName := ''; // to avoid compiler warning message
iFileCount := DragQueryFile(Msg.wParam, $FFFFFFFF, pcFileName, 255);
for i := 0 to iFileCount - 1 do
begin
iSize := DragQueryFile(Msg.wParam, i, nil, 0) + 1;
pcFileName := StrAlloc(iSize);
DragQueryFile(Msg.wParam, i, pcFileName, iSize);
if FileExists(pcFileName) then
AddFile(pcFileName); // method to add each file
StrDispose(pcFileName);
end;
DragFinish(Msg.wParam);
end;