@@ -27,6 +27,8 @@ TFileInfo = class(TObject)
2727 end ;
2828 PFileInfo = ^TFileInfo;
2929
30+ { TfrmInsertFiles }
31+
3032 TfrmInsertFiles = class (TExtForm)
3133 btnInsert: TButton;
3234 btnCancel: TButton;
@@ -89,13 +91,13 @@ TfrmInsertFiles = class(TExtForm)
8991 procedure ListColumnsPaintText (Sender: TBaseVirtualTree; const TargetCanvas: TCanvas;
9092 Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType);
9193 procedure FormDestroy (Sender: TObject);
94+ procedure FormDropFiles (Sender: TObject; const FileNames: array of string);
9295 private
9396 FConnection: TDBConnection;
9497 FMaxFileSize: Int64;
9598 FOpenDialog: TExtFileOpenDialog;
9699 public
97100 { Public declarations }
98- // procedure AcceptFiles( var msg : TMessage ); message WM_DROPFILES;
99101 end ;
100102
101103
@@ -388,6 +390,7 @@ procedure TfrmInsertFiles.AddFile(Filename: String);
388390 rx.Expression := ' \.(te?xt|html?|xml|cmd|bat|sql|ini|pas|php|h|conf|log|csv|reg|latex|wiki|patch)$' ;
389391 rx.ModifierI := True;
390392 FileInfo.IsBinary := not rx.Exec(Filename);
393+ rx.Free;
391394 NewNode := ListFiles.InsertNode(ListFiles.FocusedNode, amInsertAfter, PFileInfo(FileInfo));
392395 SelectNode(ListFiles, NewNode);
393396end ;
@@ -679,29 +682,25 @@ procedure TfrmInsertFiles.btnInsertClick(Sender: TObject);
679682end ;
680683
681684
682- { procedure TfrmInsertFiles.AcceptFiles(var msg : TMessage);
683- const
684- MaxFileNameLen = 255;
685+ procedure TfrmInsertFiles.FormDropFiles (Sender: TObject;
686+ const FileNames: array of string);
685687var
686688 i, FileCount: integer;
687- FileName: array [0..MaxFileNameLen] of char;
688689begin
689690 // Files dropped onto form
690691 Screen.Cursor := crHourglass;
691- FileCount := DragQueryFile(msg.WParam, $FFFFFFFF, FileName, MaxFileNameLen);
692- // Query Windows one at a time for the file name
692+ FileCount := Length(FileNames);
693693 ListFiles.BeginUpdate;
694694 try
695695 for i:=0 to FileCount-1 do begin
696- DragQueryFile(msg.WParam, i, FileName, MaxFileNameLen);
697- AddFile(FileName);
696+ AddFile(FileNames[i]);
698697 end ;
699698 finally
700699 ListFiles.EndUpdate;
701700 Screen.Cursor := crDefault;
702701 end ;
703- DragFinish(msg.WParam) ;
704- end; }
702+ end ;
703+
705704
706705
707706end .
0 commit comments