...but I will try til I got it!
Drag&Drop from Outlook (Express) - Possible?
Sorry Marco but I do not have Outlook here so I can't be of much help in that respect. Try running the code below and let me know what happens. I think Outlook should use the #CFSTR_FILECONTENTS which should enable you to get the actual message.
			
			
									
									Code: Select all
Structure _FILEDESCRIPTOR
  dwFlags.l
  clsid.CLSID
  sizel.SIZE
  pointl.POINT
  dwFileAttributes.l
  ftCreationTime.FILETIME 
  ftLastAccessTime.FILETIME 
  ftLastWriteTime.FILETIME 
  nFileSizeHigh.l
  nFileSizeLow.l
  cFileName.c[#MAX_PATH]
EndStructure
Structure _FILEGROUPDESCRIPTOR
  cItems.l
  fgd._FILEDESCRIPTOR[0]
EndStructure
  
If OpenWindow(0, 0, 0, 700, 500, "Drag 'n' drop",#PB_Window_SystemMenu|#PB_Window_ScreenCentered) And CreateGadgetList(WindowID(0)) 
  ListIconGadget(1,  10, 10, 680, 100, "Drop Email here", 730)
  cf_email = RegisterClipboardFormat_("Internet Message (rfc822/rfc1522)")
  cf_content = RegisterClipboardFormat_(#CFSTR_FILECONTENTS) 
  cf_descrip = RegisterClipboardFormat_(#CFSTR_FILEDESCRIPTOR)
  EnableGadgetDrop(1, cf_email, #PB_Drag_Copy)
  EnableGadgetDrop(1, cf_content, #PB_Drag_Copy)
  EnableGadgetDrop(1, cf_descrip, #PB_Drag_Copy)
  EditorGadget(2, 10, 120, 680, 400) 
  
  Repeat 
    event = WaitWindowEvent()
    If event = #PB_Event_GadgetDrop And EventGadget() = 1
      Select EventDropType()
        Case cf_email
          ClearGadgetItemList(1)
          ClearGadgetItemList(2)
          *buffer = EventDropBuffer()
          msg$ = PeekS(*buffer)
          subject = FindString(msg$, "Subject:", 1) + 9
          eos = FindString(msg$, #CRLF$, subject)
          subject$ = Mid(msg$, subject, eos - subject)
          AddGadgetItem(1, 0, subject$)
          AddGadgetItem(2, 0, PeekS(*buffer))
        Case cf_content
          MessageRequester("Hey", "#CFSTR_FILECONTENTS is working", #PB_MessageRequester_Ok | #MB_ICONINFORMATION)
        Case cf_descrip
          *fgdBuffer._FILEGROUPDESCRIPTOR = EventDropBuffer()
          eml$ = PeekS(@*fgdBuffer\fgd[0]\cFileName)
          AddGadgetItem(1, 0, eml$)
      EndSelect
    EndIf
  Until event = #PB_Event_CloseWindow
EndIf 
End
What goes around comes around.
PB 5.21 LTS (x86) - Windows 8.1
						PB 5.21 LTS (x86) - Windows 8.1
Mail just uses StringsOne thing: Why does this (attachments) work with Writestring? I always thought, Writestring makes only sense with strings....
this should help on some infos:
RFC822:
http://www.w3.org/Protocols/rfc822/
Thalius
"In 3D there is never enough Time to do Things right,
but there's always enough Time to make them *look* right."
"psssst! i steal signatures... don't tell anyone!
"
						but there's always enough Time to make them *look* right."
"psssst! i steal signatures... don't tell anyone!
Hi Sparkie, 
1. thanx for your effort. How embarrassing! I hope, I´m not turning nasty.
2. This one gives me the filename:  
 
That`s not easy...the structures I use, are pretty easy (like the PB-samples - the easy ones with no Poniters, ..).
Have you an idea, how I get the whole message, so I can writestring it?
Well, I know, you ain`t got Outlook...
3. @Thalius: Thanx you for the explanation!
thx
Marco
			
			
									
									1. thanx for your effort. How embarrassing! I hope, I´m not turning nasty.
2. This one gives me the filename:
Code: Select all
eml$ = PeekS(@*fgdBuffer\fgd[0]\cFileName)That`s not easy...the structures I use, are pretty easy (like the PB-samples - the easy ones with no Poniters, ..).
Have you an idea, how I get the whole message, so I can writestring it?
Well, I know, you ain`t got Outlook...
3. @Thalius: Thanx you for the explanation!
thx
Marco
PureBasic for Windows
						No need for embarassment Marco, I don't mind helping you figure this out.Marco2007 wrote:1. thanx for your effort. How embarrassing! I hope, I´m not turning nasty.
Yes and no as it involves digging a little deeper. It's not going to be easy since I do not have Outlook to do my trial and errors. There is still hope because Outlook Express has an alternative method for getting the messages but it's a lot more involved. If I can get it to work it should also work for Outlook...I think...I hope....Marco2007 wrote:Have you an idea, how I get the whole message, so I can writestring it?
What goes around comes around.
PB 5.21 LTS (x86) - Windows 8.1
						PB 5.21 LTS (x86) - Windows 8.1
Re:
Hey Sparkie, 
almost three years are gone since you posted your great code...and I`m not 100% shure, but Outlook didn`t work at all (iirc).
NOW: I just tried your code again with Outlook 2007, Win7 and PB 4.51 and it seems, your code is also working with Outlook attachments
 
 
thank you (again)
 
@Xombie: Have you tried it again?
http://www.purebasic.fr/english/viewtop ... 86#p243486
			
			
									
									almost three years are gone since you posted your great code...and I`m not 100% shure, but Outlook didn`t work at all (iirc).
NOW: I just tried your code again with Outlook 2007, Win7 and PB 4.51 and it seems, your code is also working with Outlook attachments
thank you (again)
@Xombie: Have you tried it again?
http://www.purebasic.fr/english/viewtop ... 86#p243486
PureBasic for Windows
						- Kwai chang caine
 - Always Here

 - Posts: 5502
 - Joined: Sun Nov 05, 2006 11:42 pm
 - Location: Lyon - France
 
Re: Drag&Drop from Outlook (Express) - Possible?
Much later but i searched this style of code for outlook express, and it's exactely what i need  
 
Great code SPARKIE, i know you are not really on the forum now then you not read this message
 , but it's important to me to thank you when even for your works, and that help us to not forget you  
 
Perhaps this message call you in the sky and give to you the desire to come, even a little time, in your forum
Again thanks, have a good day
			
			
									
									Great code SPARKIE, i know you are not really on the forum now then you not read this message
Perhaps this message call you in the sky and give to you the desire to come, even a little time, in your forum
Again thanks, have a good day
The happiness is a road...Not a destination
- 
				LuCiFeR[SD]
 - 666

 - Posts: 1033
 - Joined: Mon Sep 01, 2003 2:33 pm
 
Re: AW: Drag&Drop from Outlook (Express) - Possible?
He means like how Gotham City call for Batman LOLMarco2007 wrote:What? Sky?
What do you mean?

- Kwai chang caine
 - Always Here

 - Posts: 5502
 - Joined: Sun Nov 05, 2006 11:42 pm
 - Location: Lyon - France
 
Re: Drag&Drop from Outlook (Express) - Possible?
Exactely !! Lucifer have right !!!  
 
SPARKIE is a super hero
Since i know SPARKIE, i begin to like Batman
			
			
									
									SPARKIE is a super hero
Since i know SPARKIE, i begin to like Batman
The happiness is a road...Not a destination
Re: Drag&Drop from Outlook (Express) - Possible?
So, with this lovely bit of code as posted above, how does one actually "get at" the data content of the file itself, rather than just the file's name? The FILEDESCRIPTOR structure seems to contain some useful information about the file, but I'm not seeing anything that would allow us to examine the pure data contained within it.
For example, if I drag-and-drop a .PDF attachment received as part of an email message in Outlook, I can get its name alright, but how would I then copy/save that PDF data directly to disk if desired?
Having done a Google search and come up with the following results:
http://www.codeproject.com/Articles/714 ... -97-and-ab
http://www.codeproject.com/Articles/282 ... -Drop-in-C#
...the processes described seem nightmarishly arcane, and even then are only geared toward using C# commands. I don't know what the equivalent operations would be in PureBasic or Windows API, so I'm hoping someone here has a clue about how to do it.
Can this be accomplished?
			
			
									
									
						For example, if I drag-and-drop a .PDF attachment received as part of an email message in Outlook, I can get its name alright, but how would I then copy/save that PDF data directly to disk if desired?
Having done a Google search and come up with the following results:
http://www.codeproject.com/Articles/714 ... -97-and-ab
http://www.codeproject.com/Articles/282 ... -Drop-in-C#
...the processes described seem nightmarishly arcane, and even then are only geared toward using C# commands. I don't know what the equivalent operations would be in PureBasic or Windows API, so I'm hoping someone here has a clue about how to do it.
Can this be accomplished?
Re: Drag&Drop from Outlook (Express) - Possible?
From my continuing foray into this question, it seems that it is likely not possible from within Purebasic. Although the IDataObject needed exists in PB as a defined structure, none of its or MemoryStream's C-type methods such as GetData are available and thus cannot be invoked in order to extract the filecontents desired. A shame since the file data is undoubtedly sitting there somewhere in memory as a stream of some sort, which could be read if only an address pointer could be obtained.
Even CFSTR_FILECONTENTS is never activated by a drag-drop from Outlook, only Filedescriptor which has limited utility in this scenario.
I admit I'm largely unfamiliar with this particular operation up until now, so if I'm just missing something obvious and someone can point me in the right direction, that would be fantastic....
			
			
									
									
						Even CFSTR_FILECONTENTS is never activated by a drag-drop from Outlook, only Filedescriptor which has limited utility in this scenario.
I admit I'm largely unfamiliar with this particular operation up until now, so if I'm just missing something obvious and someone can point me in the right direction, that would be fantastic....

