Drag & Drop directly from Outlook in web app [duplicate]

孤街醉人 提交于 2019-12-18 04:59:06

问题


I know this question is relating the same problem as mine :

  • Upload fails when user drags and drops attachment from email client

but I'm looking for a workaround to achieve a drop from Outlook message into my webapp (currently only HTML5 / JS code).

Is it possible, with some activeX, to copy the message in a temp filesystem folder and then use this file reference ? I would like to know the faisability level.

Also, is it right that we can call a DLL from Jscript using ActiveX, like :

var obj = new ActiveXObject("ABCDll.testMethod");
var vResult = obj.TestMethod();
alert(vResult);

BTW, if someone has any other suggestion to do a working Drag&Drop component (IE complient) for ANY files, incl. emails from Outlook (the only things that is not working for now...)

Thanks a lot for any input.


回答1:


You can write a browser helper (for IE) in C++ or Delphi that retrieves the current drag/drop handler from IE and installs its own handler. When a message is dragged from Outlook, you can save it to a temp folder, then invoke the original drag/drop handler. After the handler returns, the temporary file can be deleted.

I have done this in the past, and it works fine. You might want to looks at the Google Gears source code (no longer supported) that intercepts drag/drop in IE.




回答2:


Outlook uses the CFSTR_FILECONTENTS and CFSTR_FILEDESCRIPTOR formats that many applications do not understand. My solution for this problem uses an Outlook Add-in to intercept the D&D and convert the proprietary format into a usual file drop (CF_HDROP).

The Add-in replaces the DoDragDrop function pointer in the import table of OLE32.DLL with a wrapper function (inside Outlook's memory address space). The wrapper converts the D&D data and calls the original function.

This article describes how to hook into an import table. Outlook's D&D stream format is explained here. The stream data has to be written into (temp) files in order to provide a simple CF_HDROP.



来源:https://stackoverflow.com/questions/19924528/drag-drop-directly-from-outlook-in-web-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!