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