I am trying to create a descendant of TShellListView that accepts files dropped from Windows Explorer. I want to handle the drag and drop in the definition of my component without the need to implement it in any of the applications using the component (I found examples of accepting files deleted from Windows Explorer, but all at the application level / TForm).
I call DragAcceptFiles () in my constructor, and I have defined a message handler for WM_DROPFILES. However, when I use this component in a sample project and drag and drop a file from Windows Explorer:
I see the "not accepted" icon (w / slash circle), and not an indication that I can delete the file.
If I try to delete a file, I do not hear Beep ().
I assume that I am warning Windows incorrectly that my control would like to accept dragged files. Can anyone suggest that I am missing?
Here, my component code with uninteresting bits is deleted:
unit LJLShellListView; interface type TLJLShellListView = class(TShellListView) private procedure WMDropFiles(var Msg: TWMDropFiles); message WM_DROPFILES; published constructor Create(AOwner: TComponent); end; implementation uses ShellAPI; constructor TLJLShellListView.Create(AOwner: TComponent); begin inherited Create(AOwner); DragAcceptFiles(self.Handle, True); end; procedure TLJLShellListView.WMDropFiles(var Msg: TWMDropFiles); begin Beep(); // I never hear this. end; end.
Larry lustig
source share