In an old message, there was some discussions about how to do D&D from Outlook 
to a wxPython app.  I'm trying to do that.  I can parse a .msg file.  That's 
not 
a problem.  The problem is retriving info from Outlook.

Getting hint from http://www.pcreview.co.uk/forums/thread-1854594.php, this is 
what I am doing:

class DropTarget(wx.PyDropTarget):
    def __init__(self):
        wx.PyDropTarget.__init__(self)
        self.do = wx.DataObjectComposite() 
        self.textdo   = wx.TextDataObject()
        self.filedo   = wx.FileDataObject()
        self.targetdo = wx.PyDataObjectSimple(format = wx.DataFormat(0xc00e))
        self.do.Add(self.textdo)
        self.do.Add(self.filedo)
        self.do.Add(self.targetdo)
        self.SetDataObject(self.do)

    def OnData(self, x, y, drag_result):
        
        if self.GetData():
            df = self.do.GetReceivedFormat().GetType()

            if df in [wx.DF_UNICODETEXT, wx.DF_TEXT]:

                win32clipboard.OpenClipboard(0)
                data=win32clipboard.GetClipboardData(CF_HDROP)
                win32clipboard.CloseClipboard()
                tfile = win32api.DragQueryFile(drag_result)

...

Unfortunately, the above code doesn't work.  CF_HDROP is not a format 
GetClipboardData recognizes, and DragQueryFile returns None.  Anybody know what 
the proper way of retrieving the dropped Outlook info?

    

> Re: [python-win32] Drag and Drop from Outlook 
>
>Mark Hammond 
>Tue, 13 Mar 2007 05:28:50 -0800 
>
>
>>    I am trying to make my application accepting drag and drop emails 
>>>from Outlook. I was told on the wxPython mailing list to try to use 
>>>win32com, but actually I have no idea which clipboard data format an 
>>>Outlook email has. I have tried to set up a custom drop target for 
>>>that: 
>>> 
>>>class MyDropTarget(wx.PyDropTarget): 
>>>    def __init__(self): 
>>>        wx.PyDropTarget.__init__(self) 
>>> 
>>>        self.data = wx.CustomDataObject("Outlook Express Messages") 
>>>        self.SetDataObject(self.data) 
>>> 
>>>But my app doesn't recongnize it with the identifier "Outlook Express 
>>>Messages". 
>>
... 


again as I told you on the wxpython ml I think it is not that 
>easy. You 
>have to use Extended Mapi to do that. At least Dmitry 
>Streblechenko, the 
>developer of OutlookSpy(really nice tool which uses a lot of mapi 
>functions) confirms that. See: 
>http://www.pcreview.co.uk/forums/thread-1854594.php 
>
There also appears to be some confusion re 'Outlook' and 'Outlook Express', 
which are quite different beasts.  If it really is 'Outlook Express', then 
I'm afraid neither win32com nor the OutlookSpy reference above are going to 
be any help.  I'm not aware of any Python tools that will help with Outlook 
express (or indeed any free tools at all!) 

FWIW, the win32clipboard module should let you get the clipboard data as a 
binary blob (and win32com.mapi does wrap extended mapi), but I'm not sure 
that will help you either. 

Good luck, 

Mark 





 --
John Henry

_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to