Originally posted by: Chakra Venkatesan
Thanks for the main article. But the comments from others really helped me solve this puzzle. Anyone interested in this should refer to the Microsoft Document refered in the other comment.
Thanks.
Chakra
Originally posted by: Mike Timms
See Clipboard Formats for more details:
See if the following sample code fixes the problem on your machine. I found that -16370 worked on one of my machines but not the other, but the sample code worked correctly for both.
BTW. Great article Craig!
Private m_AttachFormatID as string
Private Sub Init()
Dim lFormatID As Long
' Get the format ID specific to this machine
' Convert to Hex string
' Convert to unsigned integer value for magic number
End Sub
Private Sub TreeView1_OLEDragOver(Data As MSComctlLib.DataObject, Effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single, State As Integer)
'''''''''''
End Sub
Clipboard format IDs for non-standard formats can vary from machine to machine, so it;s likely that -16370 is not the correct value for the FileDescriptor format on your machine.
To find the ID on your machine you need to call the RegisterClipBoard format and then use the returned ID value converted from a long to an unsigned integer value.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/dataexchange/clipboard/clipboardformats.asp
- Mike
Private Declare Function RegisterClipboardFormat Lib "User32" Alias _
"RegisterClipboardFormatA" (ByVal lpString As String) As Long
Dim sHexID As String
lFormatID = RegisterClipboardFormat("FileGroupDescriptor")
sHexID = Hex(lFormatID)
m_AttachFormatID = Val("&H" & sHexID)
.
If (Data.GetFormat(m_AttachFormatID) = True) Then 'e-mail attachment
End If
Originally posted by: Jim Hahn
I tried implementing this solution, and it didn't work. I'm using Outlook 2000 and VB6 SP5 on Win98SE. The problem (I think) is that in the OLEDragOver event, Data.GetFormat(-16370) returns False. Data.GetFormat(3) returns True, however. 3 is equivalent to vbCFMetafile. Sure enough, if I set a control's Picture property to GetData(), it shows me the icon displayed for the attachment in Outlook. Obviously, having a graphical representation of the icon doesn't do me any good. I need the contents of the file or, better yet, the path to the attached file in a file list. In my case the attachment is a .wav file being dropped onto a ListView control, but the example using a TreeView didn't work, and neither did other types of attachments.
Originally posted by: Jamie Hornstein
I can't seem to get this to work with VB6 (SP5) and outlook XP.
I receive no errors in VB, and this event fires:
UIDragDrop_FilesDropped(ByVal file_list As String)
but file_list is always blank.
Have you found a solution for that?
ReplyOriginally posted by: Mattis Ovesen
I only get this to work when I use Copy (Ctrl+C) and Paste (Ctrl+V). If I try to drag an e-mail from Outlook and into my application, the "FileContents" data is not available in the clipboard. Anybode have any suggestions on this? (Has this something to do with delayed rendering?)
Thanks.
ReplyOriginally posted by: David Evans
I'd never have worked this out by myself.
Many Thanks!!
Originally posted by: Prasant Sunasagada
Many thanks for your effort. The details which we covered didn't fulfil my requirement. What I want if a mail or a collection of mails is dragged from Outlook Express to my application contains a com component should accept all the mail. When the files dragged to Windows Explorer it creates fils with extension eml.
Prasant
Originally posted by: Sid
amazing!!!
it is an unsolved problem for many years
(check microsoft's newsgroups)
however, it has been posted in "1999" !?
Originally posted by: A. Meyer
Believe me, I've searched the universe too! Great piece of code. I embedded it into an mfc-view/doc application - it works fine. Thank you again! Keep on coding ...
ReplyOriginally posted by: Shailesh
Thanks Buddy.
u have saved me from that agony.
:)