【发布时间】:2016-09-15 02:48:56
【问题描述】:
我正在从 Outlook 中拖放电子邮件附件。 文件被放入虚拟树视图中。
我在拖拽事件结束时的导入功能需要一段时间来处理文件,它会冻结 Outlook 应用程序,直到功能结束。
我希望能够在函数中途结束拖动操作。
procedure TForm.vstItemsDragDrop(Sender: TBaseVirtualTree;
Source: TObject; DataObject: IDataObject; Formats: TFormatArray;
Shift: TShiftState; Pt: TPoint; var Effect: Integer; Mode: TDropMode);
var
fileList : IStringList;
drop : IOleDrop;
begin
fileList:= TIStringList.Create;
drop := COleDrop.Create.def(DataObject);
fileList := drop.GetDroppedFileList(fileWarnings);
//I want to terminate the drag operator here because I already have what I need
//This imports parts takes a while to run so I want to end the drag and drop operation
//Outlook freezes still has cursor state on copy and doesn't respond to clicks or ESC
ImportParts( fileList)
end;
【问题讨论】:
-
AFAIK,在程序退出之前,您无法取消操作。您可以做的是将列表保存在某处(例如,在表单类声明中声明的变量),将自定义消息发布到您的窗口句柄,然后继续并退出拖放过程。然后,您在处理程序中处理您的列表,以处理您之后发布给自己的自定义消息。
标签: delphi drag-and-drop ole virtualtreeview tvirtualstringtree