6

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

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.

Community
  • 1
  • 1
Greezer
  • 231
  • 1
  • 5
  • 19

2 Answers2

10

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.

wimix
  • 574
  • 1
  • 5
  • 16
  • Is that functionality can only be done using C++? Do you know if something similar can be achieved using C#? – Moe Dec 28 '16 at 15:51
3

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.

Dmitry Streblechenko
  • 62,942
  • 4
  • 53
  • 78
  • I've write a BHO who's getting my "drop-destination" DIV and i'm now trying to attach a DropEvent to this DIV. However, i'm only able to use put_onDragStart(), I didn't find an event with DROP event... I've search for some tutorial or example where drag/drop handler are implement but without success. Can I ask you some input ? – Greezer Nov 27 '13 at 14:47
  • Have you looked at the Google Gears source code? You will need to drop all the way down to the Windows API level. – Dmitry Streblechenko Nov 27 '13 at 18:39
  • @Dmitry, I don't suppose you've got some sample code you could show us for the BHO you refer to? – Simon Green Oct 21 '14 at 19:07
  • 1
    No, it is a part of a commercial product, sorry. – Dmitry Streblechenko Oct 22 '14 at 03:07