Need help dropping Outlook Attachment into my Application

  • Thread starter Thread starter Joseph Geretz
  • Start date Start date
J

Joseph Geretz

Our application allows the to drag files from the Windows shell and drop
them onto our application. We handle the drop via the OLEDragDrop event. In
this event we use the following check to ensure that we're getting one (or
more) file(s) dropped onto our control.

If Data.GetFormat(vbCFFiles) = True Then ...

If so, we proceed to process the files.

It was recently brought to my attention that dragging an e-mail attachment
does not process the attachment into our application. Sure enough, I stepped
through the code and discovered that Data.GetFormat(vbCFFiles) returns False
for an e-mail attachment. How can I process e-mail attachments as the source
for an OLEDragDrop operation?

Thanks for your help,

- Joe Geretz -
 
Joseph Geretz said:
Our application allows the to drag files from the Windows shell and drop
them onto our application. We handle the drop via the OLEDragDrop event.
In this event we use the following check to ensure that we're getting one
(or more) file(s) dropped onto our control.

If Data.GetFormat(vbCFFiles) = True Then ...

If so, we proceed to process the files.

It was recently brought to my attention that dragging an e-mail attachment
does not process the attachment into our application. Sure enough, I
stepped through the code and discovered that Data.GetFormat(vbCFFiles)
returns False for an e-mail attachment.

You sure about that? I couldn't try an email attachment in Outlook Express,
but I did find one from a newsgroup post. Here is the code that I have (new
project, add a listbox to the form and set it's OLEDropMode to Manual):

Private Sub List1_OLEDragDrop(Data As DataObject, Effect As Long, Button As
Integer, Shift As Integer, X As Single, Y As Single)
Debug.Print Data.GetFormat(vbCFFiles)
Debug.Print Data.Files.Item(1)
End Sub

When I run this, and drop an attachement on there from a newsgroup post, it
puts out this:

True
C:\Documents and Settings\Matt_D\Local Settings\Temporary Internet
Files\Content.IE5\89Y38XIF\SplashFade.zip

Like I said, I can't test email attachements because we aren't allowed pop
access here, but I would ASSUME that it would work the same way -- but
you'll have to test it.

Matt
 
Hope the NG will forgive me for this small attachment. I'll test this out
from OE, let's see what I find. However, Outlook may be different than
Outlook Express. (MS seems to run out of product names so they reuse the
same name across multiple products ;-)

- Joe Geretz -
 
Hi YYZ,

I just tested this from OE (see my post directly above) and yes indeed, OE
nicely provides OLEDrop information in vbCFFiles format. However, Outlook
does not. I forwarded my previous post to myself and then tried to drag the
same attachment from Outlook to my application. In this scenario
Data.GetFormat(vbCFFiles) returns False. Ultimately, I'm sure that Outlook
is providing enough information to get the job done. However, I need
documentation on what format Outlook uses with OLE Drag and Drop in order to
program for this.

If anyone can supply me with a link to reference information, I'll be most
grateful!

- Joe Geretz -
 
Joseph Geretz said:

My bad. I read that as Outlook Express for some reason, which of course,
works fine, but that's not the question you asked!!

Data.GetFormat(vbcftext) returns true, but the data only contains 1
character, a 32, which is a space. If you put the data into a byte array,
it contains 2 items. 32 and 0 -- so, space and a null.

I'm sure this doesn't help you, but I'm not sure what else to do... I would
imagine that you would have to use some API calls or something. I mean,
obviously Windows itself can handle this, when you drag and drop onto the
desktop it works...so it's there, but VB isn't allowing you access to it.

I'm using Outlook version 2003, by the way.

Matt
 
Data.GetFormat(vbcftext) returns true, but the data only contains 1
character, a 32, which is a space. If you put the data into a byte array,
it contains 2 items. 32 and 0 -- so, space and a null.
I'm sure this doesn't help you, but I'm not sure what else to do...

Yes, you are right about this. Unfortunately, this isn't the data I need.
I'm speculating that Outlook provides some sort of pointer which points to
either an interface or memory block which contains the data I need. As you
point out, the Windows shell properly processes this drop so it's got to be
passing the information somehow. Hopefully someone can tell us more about
how we can get at this information in order to process the drop.

Thanks,

- Joe Geretz -
-----------------
 
Anyone come up with a solution for this? I'm basicall trying to do the same
thing and I'm running into the same problem.
 
April, Joe:

Me Too! I recently posted the essentially same question to
"microsoft.public.access.formscoding" and
"microsoft.public.access.modulescoding" and did not receive a single reply.
Here is my original post:

-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o Start
t -o-o-o-o-o-o-o-o-o-o-o-o-o-o-o
I appears to me that MS Access is not a Drag Drop friendly place. I see no
intrinsic support for Drag Drop operations in Access like those found in
VB6.

I am using code found here http://www.mvps.org/access/api/api0032.htm to
allow users to drag and drop files into my Access 2K application. I have
got to confess I am not enough of Win API Guru to really understand exactly
how or even why this code works.

That said, I can tell you that this code "Works Like a Champ" allowing my
users to drag and drop files from a variety of sources into the application.
The only "Snag" to date is that it refuses to accept attachments dragged
directly from Outlook email messages. Basically, the attachment when
dragged from the Outlook Email, stays a slashed circle over the target form,
indicating that a drop is not supported here. If the user Drags Drops the
attachment from the Outlook Email to the desktop and then re-drag drop it
over the target in my application all is well. I do NOT have any problems
with Outlook Express attachments. They can be dragged directly from the
Email message to my drop target without problem. I have not tested other
Email applications.

Sooo.... I am surmising that the problem is in the way Outlook handles drag
drop operations. Is anyone out there familiar with this problem? I started
Goggling and found only a couple of hits that were on target, but alas
neither of them is a VB/VBA solution.

For those of you who are interested have a look at:
http://www.devnewsgroups.net/link.aspx?url=http://codeproject.com/csharp/TestEmailDragDrop.asp
for a C# solution or:
http://www.codeguru.com/Cpp/I-N/internet/email/article.php/c3381/ for a VB
solution with a helper DLL created in C.

I am hoping that some of you RSG's (Really Smart Guys/Gals) out there have
either run into this before, and have a ready made solution, or are willing
to pick up the gauntlet and see if you can find a solution.
-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o End
t -o-o-o-o-o-o-o-o-o-o-o-o-o-o-o

Perhaps you will find the link to
http://www.codeguru.com/Cpp/I-N/internet/email/article.php/c3381/ useful, in
that it is a VB solution that uses VB's standard (more or less I guess)
OLEDragOver and OLEDragDrop events to handle "Normal" files and "Outlook
Email Attachments".

For poor old me I am still stuck as I can not distribute another file (a
helper DLL) to all of the desktops that need to use this app, and Access
does not have anything that even smells like VB's OLEDragOver and
OLEDragDrop events. In fact the standard Access controls do not even have a
Hwnd. Sheesh!!!

I have spent a fair amount of time researching this problem, and these two
links are all that I was able to come up with. Pretty please with a cherry
on top please post back here if you find anything else that might even
remotely be applicable to my problem.

Thanks

Ron W
 
I found this article over at CodeGuru, but I don't have time to test it out.
Let me know if it helps.

http://www.codeguru.com/Cpp/I-N/internet/email/article.php/c3381/


Our application allows the to drag files from the Windows shell and drop
them onto our application. We handle the drop via the OLEDragDrop event. In
this event we use the following check to ensure that we're getting one (or
more) file(s) dropped onto our control.

If Data.GetFormat(vbCFFiles) = True Then ...

If so, we proceed to process the files.

It was recently brought to my attention that dragging an e-mail attachment
does not process the attachment into our application. Sure enough, I stepped
through the code and discovered that Data.GetFormat(vbCFFiles) returns False
for an e-mail attachment. How can I process e-mail attachments as the source
for an OLEDragDrop operation?

Thanks for your help,

- Joe Geretz -
 
Back
Top