我正在使用 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;
这段代码没有问题。另外,当我拖放文件时,光标显示状态更改为拖放,但在拖放后,什么也没有发生(也没有显示消息)。这有什么问题吗?