How can I allow a form to accept file dropping without handling Windows messages?

前端 未结 5 1855
没有蜡笔的小新
没有蜡笔的小新 2020-11-29 03:54

In Delphi XE can I allow my form to accept file \'drag and drop\' but without having to handle bare windows messages?

5条回答
  •  臣服心动
    2020-11-29 04:41

    I used David Heffernan's solution as base for my test application and got 'Invalid pointer operation' on application close. The solution for that problem was to change the TDropTarget.Create by adding '_Release;'

    constructor TDropTarget.Create(AHandle: HWND; const ADragDrop: IDragDrop);
    begin
      inherited Create;
      FHandle := AHandle;
      FDragDrop := ADragDrop;
      RegisterDragDrop(FHandle, Self);
      _Release;
    end;
    

    A discussion about this problem you can see on Embarcadero forum.

提交回复
热议问题