相关疑难解决方法(0)

为什么我的表单在文件被删除时不会收到WM_DropFiles?

我正在使用Embarcadero RAD Studio XE来开发应用程序.我正在尝试使用以下代码将文件拖放到应用程序中

TMainForm = class(TForm)
public:
  procedure WMDropFiles(var Msg: TWMDropFiles); message WM_DROPFILES;
end;

procedure TMainForm.FormCreate(Sender: TObject);
begin
  DragAcceptFiles(Self.Handle, True);
end;

procedure TMainForm.FormDestroy(Sender: TObject);
begin
  DragAcceptFiles(Self.Handle, False);
end;

procedure TMainForm.WMDropFiles(var Msg: TWMDropFiles);
begin
  inherited;
  showmessage('catch here');
  // some code to handle the drop files here
  Msg.Result := 0;
end;
Run Code Online (Sandbox Code Playgroud)

这段代码没有问题.此外,当我拖放文件时,光标显示状态已更改为拖放,但在删除后,没有任何反应(也未显示任何消息).这有什么不对吗?

delphi drag-and-drop

6
推荐指数
2
解决办法
3904
查看次数

标签 统计

delphi ×1

drag-and-drop ×1