Page 1 of 1

dropmaster from outlook

PostPosted: Mon Dec 03, 2012 9:54 am
by PlawCoder
I have a problem with some outlook atachments. These are emails embedded as attachments in an email.
When they are dragged onto a dropmaster enabled control the check for contents gives incorrect information.

hasOutlookFormats := DMTextTarget1.DataObjectHasFormat(sFileGroupDescriptor);
DataObjectTymed := TYMED_ISTREAM;
hasOutlookFormats := DMTextTarget1.DataObjectHasFormat(sFileContents) and hasOutlookFormats ;

On these drags line 1 returns true where line 3 returns false. If I ignore the results from line 3 and then use
DataObjectTymed := TYMED_ISTORAGE;
t := DMTextTarget1.DataObjectGetFormat(sFileContents);
or
DataObjectTymed := TYMED_ISTREAM;
t := DMTextTarget1.DataObjectGetFormat(sFileContents);
to get results, one of these will return that email attachment being dragged.

Is is safe to process the drop this way or is there another method to check the drop contents?

Re: dropmaster from outlook

PostPosted: Mon Dec 03, 2012 11:39 am
by DropMaster
That should be OK. I'll check to see if I can reproduce this. Where did you grab that original example code from? It looks as though attached emails are embedded as storages rather than as streams, so this could just be a corner case that's missing from the example. You can probably modify the test to be "(has filegroupdescriptor and ((has filecontents on istream) or (has filecontents on istorage)))" in general.

Hope this helps.

Re: dropmaster from outlook

PostPosted: Mon Dec 03, 2012 11:46 am
by PlawCoder
how would i check for
((has filecontents on istream) or (has filecontents on istorage))"
this is with VCL
in the examples it just mentions DataObjectHasFormat('filecontents')

thanks

Re: dropmaster from outlook

PostPosted: Mon Dec 03, 2012 12:08 pm
by DropMaster
You've been doing it all along.

DataObjectTymed = TYMED_ISTREAM;
hasOutlookFormats := DMTextTarget1.DatatObjectHasFormats(sFileContents);

means "has filecontents on IStream)". (Use TYMED_ISTORAGE instead to check on an IStorage). If you don't assign DataObjectTymed, the default is TYMED_HGLOBAL (a global memory handle). Otherwise, it checks (just once, before reverting to the default) using the medium most recently assigned to DataObjectTymed.

Hope this helps.

Re: dropmaster from outlook

PostPosted: Mon Dec 03, 2012 12:12 pm
by PlawCoder
Thanks that is what I wanted to verify