Moin,
ich versuche eine Outlooknachricht per Drag & Drop in einem Ordner als *.msg Datei mit @water's UDF zu speichern.
Anbei der Code. Es funktioniert leider nicht.
könnt ihr mir helfen?
Spoiler anzeigen
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include "DragDropEvent.au3"
#include <OutlookExConstants.au3>
#include <OutlookEX.au3>
#include <Array.au3>
Opt("MustDeclareVars", 1)
DragDropEvent_Startup()
Main()
Exit
Func Main()
Local $MainWin = GUICreate("DragDrop", 380, 130, -1, -1, -1, $WS_EX_TOPMOST)
GUISetFont(12, 900)
GUICtrlCreateLabel("(DragDrop)", 40, 40)
DragDropEvent_Register($MainWin)
GUIRegisterMsg($WM_DRAGENTER, "OnDragDrop")
GUIRegisterMsg($WM_DRAGOVER, "OnDragDrop")
GUIRegisterMsg($WM_DRAGLEAVE, "OnDragDrop")
GUIRegisterMsg($WM_DROP, "OnDragDrop")
GUISetState(@SW_SHOW)
While GUIGetMsg() <> $GUI_EVENT_CLOSE
WEnd
GUIDelete()
EndFunc ;==>Main
Func OnDragDrop($hWnd, $Msg, $wParam, $lParam)
Static $DropAccept
Switch $Msg
Case $WM_DRAGENTER, $WM_DROP
ToolTip("")
Select
Case DragDropEvent_IsFile($wParam)
If $Msg = $WM_DROP Then
Local $FileList = DragDropEvent_GetFile($wParam)
MsgBox(262144, "DragDropEvent", StringReplace($FileList, "|", @LF))
EndIf
$DropAccept = $DROPEFFECT_COPY
Case DragDropEvent_IsText($wParam)
If $Msg = $WM_DROP Then
Global $oOApp = ObjCreate("Outlook.Application")
Global $oItems = $oOApp.GetDefaultFolder($olFolderInbox).Items
ObjEvent($oItems, "oItems_")
Global $oItem = DragDropEvent_GetText($wParam)
Msgbox(1,"",$oItem)
Global $oOutlook = _OL_Open()
Global $SendMailFile = "D:\Hallo.msg"
_OL_ItemSave($oOutlook, $oItem, Default, $SendMailFile, $olMSGUnicode)
$oItem.Display
EndIf
$DropAccept = $DROPEFFECT_COPY
Case Else
$DropAccept = $DROPEFFECT_NONE
EndSelect
Return $DropAccept
Case $WM_DRAGOVER
Local $X = DragDropEvent_GetX($wParam)
Local $Y = DragDropEvent_GetY($wParam)
ToolTip("(" & $X & "," & $Y & ")")
Return $DropAccept
Case $WM_DRAGLEAVE
ToolTip("")
EndSwitch
EndFunc ;==>OnDragDrop
Func oItems_ItemAdd($oOL_Item)
MsgBox(64, "OutlookEX UDF Example Script", "Mail has been sent!" & @CRLF & @CRLF & _
"Subject: " & $oOL_Item.Subject)
_OL_ItemSave($oOutlook, $oOL_Item, Default, $SendMailFile, $olMSGUnicode)
EndFunc ;==>oOFolder_ItemAdd