Reputation: 7062
When dragging an attachment from the New Outlook to Windows Explorer the file gets dropped* at that location, when dragging an email from the New Outlook to Windows Explorer, the file gets dropped* at that location after dismissing a security warning in Outlook. (* dropped means it gets copied from %temp%\chrome_drag_<pid of webview2 exe>_<somenumber>\ to its final destination.)
I want to handle those drops in my Delphi application. I have a droptarget, but when enumerating the data formats I get the following:
I can parse the last format, it gives me ids which I assume can be used to download the email or attachment via Microsoft Graph, but that requires interaction with Microsoft Graph, Windows Explorer doesn't need that and I don't want to.
My hopes are with CF_HDROP, but dataObj.GetData fails with a DV_E_FORMATETC error code.
My code:
procedure TSACustomDropTarget.DoDrop(const dataObj: IDataObject; grfKeyState: Integer; pt: TPoint; var dwEffect: Integer);
var
lFormat: TFormatEtc;
lMedium: TStgMedium;
begin
lFormat.cfFormat := CF_HDROP;
lFormat.ptd := nil;
lFormat.dwAspect := DVASPECT_CONTENT;
lFormat.lindex := -1;
lFormat.tymed := TYMED_HGLOBAL;
if dataObj.GetData(lFormat, lMedium) = S_OK then // Returns DV_E_FORMATETC, but dataObj.GetQueryData(lFormat) returns S_OK
begin
// Get files using DragQuery...
end;
end;
How can I get CF_HDROP to work, or is there another way to get the file from New Outlook?
Upvotes: 3
Views: 105