Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to get FileContents stream from drag & drop or clipboard

259 views
Skip to first unread message

Gerrit

unread,
Jan 23, 2003, 1:47:31 PM1/23/03
to
Hi.

My application needs to accept files via drag & drop and the
clipboard. Getting files dropped via the Windows Explorer is very easy
and well documented.
There are some applications (e.g. Outlook and Outlook Express) that
provide "virtual" files via a FileGroupDescriptor and FileContents.
It's very easy to get the FileGroupDescriptor in .NET, but I see no
way to provide the required FORMATETC structure that you would
normally send when calling IDataObject::GetData in C++ (see
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/
platform/shell/programmersguide/shell_basics/shell_basics_programming/
transferring/clipboard.asp) to get the stream of the specified file.

How can I get the FileContents of a virtual file .NET that is on the
clipboard
or dragged & dropped on my application?


TIA,

Gerrit

t

unread,
Jan 23, 2003, 10:00:57 PM1/23/03
to
Hi,

This is an interesting area and lot of people seem to be looking for the
answer. The long and short of it is that the contents of the items are left
in outlook and enough information is passed to you in the
"RenPrivateMessages" stream to find the item. Once you decode the stream
you can then get the outlook object and use the getitemfromid function to
retrieve the object. The structure is a bit interesting but basically it
looks like this.

The first byte represents the number of bytes for the folder id. However
the folder id doesn't start for another 4 bytes.

The byte after the end of the folder ID is the number of bytes representing
the store id (again data actually starting another 4 bytes along).

Then there is a number of bytes (21) that contain the number of items.
Bytes 12 & 13. Note that to get the number you need to combine them in the
reverse order ie. convert byte(13) to hex and then byte(12) and then
convert the two together.

You then need to find the starting point of the Message ID (the key part).
To find this you search through until you reach a 0 byte. When the item has
a subject then the byte previous to this location indicates the length of
the message id, when there is no subject the next byte indicates the length
of the message id, generally it should be either 40 (Exchange) or 24 (PST).
Still starting 4 bytes along.

That pretty much sums it up - if there is another item then you only need to
skip along another 44 bytes to get to the next item and begin the search for
the message id.

You can check to see how you are going by asking outlook for the folder id,
store id and message id. Note that the message id's don't line up with
outlook when you are using exchange (note this is not a problem), but they
do when you use a pst file. All this was with Outlook 2000

Good luck.

Ross.

"Gerrit" <gs...@talius.net> wrote in message
news:uHckMAxwCHA.1900@TK2MSFTNGP11...

Gerrit

unread,
Jan 24, 2003, 5:01:26 AM1/24/03
to

Thanks for your reply. Unfortunately, I must get these "virtual" files
from different applications (not just Outlook). It's quite clear how
to do it in good old C++, but it looks like they have removed some of
the functionality of the DataObject.GetData method: You can no longer
supply the required FORMATETC structure with the index of the file to
retrieve.

Gerrit


"t" <nom...@nomail.com> wrote in message
news:J%1Y9.1017$YU1....@news.optus.net.au...

cmn

unread,
Jan 29, 2003, 5:39:08 PM1/29/03
to
okay, and whats with the exchange?

on elements in exchange u dont have the "RenPrivateMessages".

and do u have an example?

thanks,

christoph richter

"t" <nom...@nomail.com> wrote in message news:<J%1Y9.1017$YU1....@news.optus.net.au>...

0 new messages