To grab names of multiple dropped Outlook messages is the easy part.
Retrieving the data is the tricky part.
If you can't figure it out, you might be-able to work with the the location of the .PST file you can get from the clipboard and with the message name, get the msg contents you are seeking.
Regards to grabbing the names of multiple dropped Outlook messages. Nothing fancy but here's the code:
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
Enumeration
#ImageSource
#ImageTarget
EndEnumeration
Enumeration
#Window = 0
#TargetOutlook
#TargetMsG
EndEnumeration
If OpenWindow(#Window, 0, 0, 760, 510, "Drag & Drop", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
CreateImage(#ImageSource, 136, 136)
If StartDrawing(ImageOutput(#ImageSource))
Box(0, 0, 136, 136, $FFFFFF)
DrawText(5, 5, "Drag this image", $000000, $FFFFFF)
For i = 45 To 1 Step -1
Circle(70, 80, i, Random($FFFFFF))
Next i
StopDrawing()
EndIf
CreateImage(#ImageTarget, 136, 136)
If StartDrawing(ImageOutput(#ImageTarget))
Box(0, 0, 136, 136, $FFFFFF)
DrawText(5, 5, "Drop images here", $000000, $FFFFFF)
StopDrawing()
EndIf
ListIconGadget(#TargetOutlook, 0, 0, 760, 150, "Outlook Messages" , 749)
EditorGadget(#TargetMsG, 20, 160, 720, 330)
; rfc822_rfc1522 = RegisterClipboardFormat_("Internet Message (rfc822/rfc1522)")
HTML = RegisterClipboardFormat_("HTML Format")
cf_descrip = RegisterClipboardFormat_(#CFSTR_FILEDESCRIPTOR)
cf_content = RegisterClipboardFormat_(#CFSTR_FILECONTENTS)
EnableGadgetDrop(#TargetOutlook, #PB_Drop_Text, #PB_Drag_Copy|#PB_Drag_Move|#PB_Drag_Link)
EnableGadgetDrop(#TargetOutlook, #PB_Drop_Files, #PB_Drag_Copy|#PB_Drag_Move|#PB_Drag_Link)
; EnableGadgetDrop(#TargetOutlook, #PB_Drop_Image, #PB_Drag_Copy|#PB_Drag_Move|#PB_Drag_Link)
If HTML : iFormat = HTML : ElseIf rfc822_rfc1522 : iFormat = rfc822_rfc1522 : EndIf
If iFormat : EnableGadgetDrop(#TargetOutlook, iFormat, #PB_Drag_Copy|#PB_Drag_Move|#PB_Drag_Link) : EndIf
If cf_content : EnableGadgetDrop(#TargetOutlook, cf_content, #PB_Drag_Copy|#PB_Drag_Move|#PB_Drag_Link) : EndIf
If cf_descrip : EnableGadgetDrop(#TargetOutlook, cf_descrip, #PB_Drag_Copy|#PB_Drag_Move|#PB_Drag_Link) : EndIf
dFormat.s
Repeat
Event = WaitWindowEvent()
If Event = #PB_Event_Gadget And EventType() = #PB_EventType_DragStart
ElseIf Event = #PB_Event_GadgetDrop
Select EventGadget()
Case #TargetOutlook
Select EventDropType()
Case #PB_Drop_Text
ClearGadgetItems(#TargetOutlook) : ClearGadgetItems(#TargetMsG)
AddGadgetItem(EventGadget(), -1, "#PB_Drop_Text["+Str(EventDropSize())+"]: " + EventDropText())
AddGadgetItem(#TargetMsG, -1, EventDropText())
Case #PB_Drop_Files : i = 0
Files$ = EventDropFiles() :
Count = CountString(Files$, Chr(10)) + 1
For i = 1 To Count
AddGadgetItem(EventGadget(), -1, "#PB_Drop_Files: " + StringField(Files$, i, Chr(10)))
Next i
Case iFormat
ClearGadgetItems(#TargetOutlook) : ClearGadgetItems(#TargetMsG)
*Buffer = EventDropBuffer()
If HTML
AddGadgetItem(EventGadget(), -1, "[iFormat]: HTML: " + PeekS(*Buffer, 30, #PB_Ascii))
AddGadgetItem(#TargetMsG, -1, PeekS(*Buffer, EventDropSize(), #PB_Ascii))
ElseIf rfc822_rfc1522
msg$ = PeekS(*Buffer, EventDropSize(), #PB_Ascii)
Subject = FindString(msg$, "Subject: ", 1) + 9
eos = FindString(msg$, #CRLF$, Subject)
subject$ = Mid(msg$, Subject, eos - Subject)
AddGadgetItem(EventGadget(), -1, "[iFormat]: rfc822_rfc1522: " + subject$)
AddGadgetItem(#TargetMsG, -1, PeekS(*Buffer, EventDropSize(), #PB_Ascii))
Else
MessageRequester("Default", "[iFormat]: Not Handled: "+Str(EventDropType()), #PB_MessageRequester_Ok | #MB_ICONINFORMATION)
If *Buffer : AddGadgetItem(#TargetMsG, -1, PeekS(*Buffer, EventDropSize(), #PB_Ascii)) : EndIf
EndIf
Case cf_content : MessageRequester("Hey", "#CFSTR_FILECONTENTS is working", #PB_MessageRequester_Ok | #MB_ICONINFORMATION)
Case cf_descrip
dFormat = "[cf_descrip]: "
If HTML : dFormat + "HTML: "
ElseIf rfc822_rfc1522 : dFormat + "rfc822_rfc1522: "
Else : dFormat + "???: "
EndIf
*fgdBuffer._FILEGROUPDESCRIPTOR = EventDropBuffer()
ItemsCount = *fgdBuffer\cItems
ClearGadgetItems(#TargetOutlook) : ClearGadgetItems(#TargetMsG)
For i=0 To ItemsCount-1
eml$ = PeekS(@*fgdBuffer\fgd[i]\cFileName)
AddGadgetItem(EventGadget(), -1, dFormat+eml$)
Next
Default
MessageRequester("Drag&Drop:", "Not Handled: "+Str(EventDropType()), #PB_MessageRequester_Ok | #MB_ICONINFORMATION)
EndSelect
EndSelect
EndIf
Until Event = #PB_Event_CloseWindow
EndIf
End