This topic obviously has been hitted over and over again here, but now I just run out of options from my point of view.
OS: Windows XP SP3
So, here is Drag and Drop example for RichEdit I use in my app:
procedure TForm1.AcceptFiles( var msg : TMessage ); // or TWMDROPFILES
const
cnMaxFileNameLen = 255;
var
i,
nCount : integer;
acFileName : array [0..cnMaxFileNameLen] of char;
begin
// find out how many files we're accepting
nCount := DragQueryFile( msg.WParam, // or msg.Drop
$FFFFFFFF,
acFileName,
cnMaxFileNameLen );
// query Windows one at a time for the file name
for i := 0 to nCount-1 do
begin
DragQueryFile( msg.WParam, { or msg.Drop} i,
acFileName, cnMaxFileNameLen );
// do your thing with the acFileName
MessageBox( Handle, acFileName, '', MB_OK );
end;
// let Windows know that you're done
DragFinish( msg.WParam ); // or msg.Drop
end;
Problem is that after some recent changes ( unforutinetly I do not use any SVN so I cannot track which commit was introducing this issue ) Drag and Drop do not work any more.
I have run breakpoints without success in every event that might be somehow related ( called ):
RichEditMouseOver;
RichEditChange;
FormClick;
My app is processing these WM's:
procedure WMDropFiles(var Msg: TWMDROPFILES); message WM_DROPFILES;
procedure WMSysCommand(var Msg: TWMSysCommand); message WM_SYSCOMMAND;
procedure WMCopyData(var Msg: TWMCopyData); message WM_COPYDATA;
procedure WMGetMinMaxInfo(var AMsg: TWMGetMinMaxInfo); message WM_GETMINMAXINFO;
procedure CMDialogKey(var Msg: TCMDialogKey ); message CM_DIALOGKEY;
On blank project with TRichEdit on form - all is working OK.
Also tried changing DragAcceptFiles()
Form1.Handle
to RichEdit.Handle
- still no luck.
When echo'ing nCount
and acFileName
parameters, acFileName do not have File Path of Dragged file ... Why????
Currently I just have no clue what makes the acFileName parameter losing Dragged files path. Could you suggest where problem is hiding?