Page 1 of 7
					
				Drag&Drop from Outlook (Express) - Possible?
				Posted: Fri May 09, 2008 6:52 pm
				by Marco2007
				Hi, 
does anyone know, how to drag&drop a msg-File (Outlook) or an eml-File (Outlook Express) to a e.g. Listicon? 
I can do it from outlook to desktop and then from the desktop to a Listicon, but not the direct way. 
I don`t want to use Webgadget for that...
What do I want to? -> I just wanna drag a message to e.g. Listicongadget -> this means saving the message to a special folder. 
Does anyone know, if this is possible?  
Thank you
Marco
			 
			
					
				
				Posted: Sat May 10, 2008 2:20 am
				by freak
				You can handle any format with the PB DragDrop lib in theory.
You just have to know the format name and get an ID with RegisterClipboardFormat_() 
Then call EnableGadgetDrop() with this format.
Then when you receive a drop event. EventDropSize() and EventDropBuffer()
can be used to access the data.
So it comes down to finding out the clipboard/drag & drop format used by Outlook.
Maybe this is documented somewhere. google is your friend.
			 
			
					
				
				Posted: Sat May 10, 2008 9:33 pm
				by Marco2007
				1. Thank you
2. That`s too difficult for me...
I have no idea, what to do:
First I thought, I just have to do something like this: 
Code: Select all
EnableGadgetDrop(#ListIcon, RegisterClipboardFormat_("outlook.application"), #PB_Drag_Copy)
  
thanx, 
Marco
 
			 
			
					
				
				Posted: Sun May 11, 2008 9:30 pm
				by Sparkie
				For single message drag'n'drop, I use 
Code: Select all
cf_email = RegisterClipboardFormat_("Internet Message (rfc822/rfc1522)")
EnableGadgetDrop(#ListIcon, cf_email, #PB_Drag_Copy)
 
			 
			
					
				
				Posted: Sun May 11, 2008 10:37 pm
				by Marco2007
				Hi Sparkie, 
1. Thank you again!
2.  

  (rfc822/rfc1522) -> where did you get that and how can I get it for Outlook? 
Do you know, how the file with such an Drag&Drop-Action can be stored e.g. c:\
This is the shorten code: 
Code: Select all
Enumeration
  #Window
EndEnumeration
Enumeration
  #ListIcon
EndEnumeration
Procedure Open_Window()
  If OpenWindow(#Window, 820, 328, 448, 220, "Test",  #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar )
    If CreateGadgetList(WindowID(#Window))
      
      ;-
      ListIconGadget(#ListIcon, 20, 35, 350, 145, "Column", 340)
      ButtonGadget(1,380, 170, 40, 20, "ok")
    EndIf
  EndIf
EndProcedure
Open_Window() 
;cf_email = RegisterClipboardFormat_("Internet Message (rfc822/rfc1522)") 
Debug cf_email
EnableGadgetDrop(#ListIcon, cf_email, #PB_Drag_Copy)
Repeat
event=WaitWindowEvent()
      
If Event = #PB_Event_GadgetDrop
      Select EventGadget()
      Case #ListIcon
        ;Files$ = EventDropFiles() 
        Debug EventDropType()
        Debug EventDropSize() 
        Debug EventDropBuffer()
        Count  = CountString(Files$, Chr(10)) + 1
        For i = 1 To Count
          AddGadgetItem(#ListIcon, -1, StringField(Files$, i, Chr(10)))
        Next i
      EndSelect 
 EndIf
 Until event=#WM_CLOSE 
 
thx
Marco
I owe you one
 
			 
			
					
				
				Posted: Sun May 11, 2008 10:52 pm
				by Sparkie
				1. You're Welcome 
2. Google was my friend. 

 I have no clue about Outlook but I will take a look and see what I can find for you.
To save the message, I load the email into an EditorGadget and from there I save them as needed. 

 
			 
			
					
				
				Posted: Sun May 11, 2008 11:04 pm
				by Sparkie
				For Outlook, try these...
Code: Select all
RegisterClipboardFormat_(#CFSTR_FILECONTENTS)
RegisterClipboardFormat_(#CFSTR_FILEDESCRIPTOR)
 
			 
			
					
				
				Posted: Mon May 12, 2008 10:17 am
				by Marco2007
				Thanx, Sparkie! It works with the Editor (but I got Problems with attachments - I only get the header in textformat)
Why isn`t that so easy like dragging from Explorer  
 
From explorer I could do this: 
Code: Select all
Case #TargetFiles
          Files$ = EventDropFiles()
          CopyFile(Files$, "D:\"+GetFilePart(files$))
  
Why doesn´t this one work? I guess, because it`s simply wrong!
Code: Select all
Case #ListIcon
        ;Files$ = EventDropFiles() 
        Debug EventDropType()
        size.l=EventDropSize() 
        *buffer=EventDropBuffer()
        Debug size
        Debug *buffer
        If CreateFile(0, "d:\Text.eml")   
          WriteData(0, *buffer, size)  
          CloseFile(0)                      
        Else
          MessageRequester("Sorry", "Konnte die Datei nicht erstellen!")
        EndIf
 
The easiest way is webgadget, but in this case I don`t like the view with all the other folders and files... 
thx
Marco
 
			 
			
					
				
				Posted: Mon May 12, 2008 1:03 pm
				by Sparkie
				I use this to retrieve the message text
 
			 
			
					
				
				Posted: Mon May 12, 2008 2:13 pm
				by Marco2007
				Hi Sparkie, my friend!
...means that the messages can`t be just dropped like e.g. on the desktop, or am I wrong? 
thx
Marco
			 
			
					
				
				Posted: Mon May 12, 2008 2:55 pm
				by Sparkie
				I'm at work right now Marco but when I get home I'll link you to an app of mine and you can see if it does what you want. 
 
I'm not sure how the Desktop handles a drag'n'drop, but with Outlook Express, email messages are all contained in a single *.dbx files. such as Inbox.dbx, Sent.dbx and so on. AKAIK, the actual *.eml file does not exist until the target drag'n'drop handler creates it, which in my case is my app.
 
			 
			
					
				
				Posted: Mon May 12, 2008 5:07 pm
				by Sparkie
				Marco, try this code with Outlook Express ansd see if it's what you're looking for.
Code: Select all
If OpenWindow(0, 0, 0, 700, 500, "Drag 'n' drop Outlook Express",#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)")
  EnableGadgetDrop(1, cf_email, #PB_Drag_Copy)
  EditorGadget(2, 10, 120, 680, 370) 
  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))
      EndSelect
    EndIf
  Until event = #PB_Event_CloseWindow
EndIf 
End
 
			 
			
					
				
				Posted: Mon May 12, 2008 5:33 pm
				by Marco2007
				Hi Sparkie, 
Code works very good. 
Could you try this, please: 
Please, drag&drop a message from Outlook Express on the desktop...then you ot an eml-file on it. Is something like that possible? 
thx
Marco
			 
			
					
				
				Posted: Mon May 12, 2008 5:54 pm
				by Sparkie
				Sure, just add this, making sure you change the path to your desired location. 
Code: Select all
eml = CreateFile(#PB_Any, "c:\" + subject$ + ".eml")
          WriteString(eml, msg$)
 
			 
			
					
				
				Posted: Mon May 12, 2008 6:12 pm
				by Marco2007
				
  
  
   
  
 
WOW!! That works...even with attachments  
 
Sparkie, you`re great! 
One thing: Why does this (attachments) work with Writestring? I always thought, Writestring makes only sense with strings.... 
thank you so much  
 
Marco