OLE drag & drop from Outlook / Outlook express?


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 7 of 7

Thread: OLE drag & drop from Outlook / Outlook express?

  1. #1
    Pino Carafa Guest

    OLE drag & drop from Outlook / Outlook express?

    Hello all,

    When I check the OLEDragDrop procedure for a VB control I think some
    information may be hidden away or not available through standard VB.

    For example, when dropping e-mails from Outlook, you get a String containing
    of some sort of "table" with the "headings" of the columns in your view for
    the selected e-mails. In outlook express it's even weirder.... Drop one
    e-mail and you get a String containing the full body text. Drop multiple
    e-mails and no dataformat seems to fit the bill.

    Further, if you drag e-mails from either onto the desktop, the operating
    system seems to know:
    - where the data came from
    - what to do with it so that it can create the .msg or whatever files on
    your desktop...

    So, there must be much more data available than is easily available through
    "vanilla" VB.

    How can one access this other information?



  2. #2
    Eduardo A. Morcillo Guest

    Re: OLE drag & drop from Outlook / Outlook express?

    If you are using the automatic drop mode, VB only gets the data supported by
    the target control (text and imag es).

    Using manual mode you can get the data on any format that the data supports
    (even formats not supported by VB) using the GetData method. The only thing
    you need is the format ID. To check if the data supports a format you have
    to use Data.GetFormat function.

    For example, if you drag a picture from IE to a picture box you can get the
    data in 3 ways:

    1) The image as a DIB
    2) The image filename (in the IE cache)
    3) The HTML tag

    Private Sub Picture1_OLEDragDrop(Data As DataObject, Effect As Long, Button
    As Integer, Shift As Integer, X As Single, Y As Single)
    Dim HTMLTag As String, lCF_HTML As Long
    Dim CF_HTML As Integer

    lCF_HTML = RegisterClipboardFormat("HTML Format")

    MoveMemory CF_HTML, lCF_HTML, 2

    Set Picture1.Picture = Data.GetData(vbCFDIB)
    MsgBox "The cached file is " & Data.Files(1)
    MsgBox "HTML Format: " & vbCrLf & StrConv(Data.GetData(CF_HTML),
    vbUnicode)

    End Sub

    BTW, data dragged & dropped from Outlook Express supports the following
    formats:

    Outlook Express Messages
    FileGroupDescriptor
    FileGroupDescriptorW
    FileContents

    If only 1 message is dragged it also supports:

    Internet Message (rfc822/rfc1522)
    CF_UNICODETEXT
    vbCFText


    HTH

    --
    Eduardo A. Morcillo
    http://www.domaindlx.com/e_morcillo





  3. #3
    Eduardo A. Morcillo Guest

    Re: OLE drag & drop from Outlook / Outlook express?

    If you are using the automatic drop mode, VB only gets the data supported by
    the target control (text and imag es).

    Using manual mode you can get the data on any format that the data supports
    (even formats not supported by VB) using the GetData method. The only thing
    you need is the format ID. To check if the data supports a format you have
    to use Data.GetFormat function.

    For example, if you drag a picture from IE to a picture box you can get the
    data in 3 ways:

    1) The image as a DIB
    2) The image filename (in the IE cache)
    3) The HTML tag

    Private Sub Picture1_OLEDragDrop(Data As DataObject, Effect As Long, Button
    As Integer, Shift As Integer, X As Single, Y As Single)
    Dim HTMLTag As String, lCF_HTML As Long
    Dim CF_HTML As Integer

    lCF_HTML = RegisterClipboardFormat("HTML Format")

    MoveMemory CF_HTML, lCF_HTML, 2

    Set Picture1.Picture = Data.GetData(vbCFDIB)
    MsgBox "The cached file is " & Data.Files(1)
    MsgBox "HTML Format: " & vbCrLf & StrConv(Data.GetData(CF_HTML),
    vbUnicode)

    End Sub

    BTW, data dragged & dropped from Outlook Express supports the following
    formats:

    Outlook Express Messages
    FileGroupDescriptor
    FileGroupDescriptorW
    FileContents

    If only 1 message is dragged it also supports:

    Internet Message (rfc822/rfc1522)
    CF_UNICODETEXT
    vbCFText


    HTH

    --
    Eduardo A. Morcillo
    http://www.domaindlx.com/e_morcillo





  4. #4
    Pino Carafa Guest

    Re: OLE drag & drop from Outlook / Outlook express?

    Hello Eduardo,

    It helps.... but I shamefacedly admit that most of your post went straight
    over my head.

    Yes, I'm using manual drop mode alright, but I'm not sure how to proceed
    from there...

    "data dragged & dropped from Outlook Express supports the following
    formats:

    Outlook Express Messages
    FileGroupDescriptor
    FileGroupDescriptorW
    FileContents"

    What are the values of those Format IDs? Where can I find out this sort of
    information?

    Let's say I use GetData for Outlook Express Messages..... How?

    Sorry, I'm a complete ignoramus in this area of VB programming, so I hope
    you'll be able to help me with an idiot's guide... or some references where
    I can read up on this stuff.

    Thanks

    Pino


    Eduardo A. Morcillo <edanmo@geocities.com> wrote in message
    news:38eca1a0@news.devx.com...
    If you are using the automatic drop mode, VB only gets the data supported by
    the target control (text and imag es).

    Using manual mode you can get the data on any format that the data supports
    (even formats not supported by VB) using the GetData method. The only thing
    you need is the format ID. To check if the data supports a format you have
    to use Data.GetFormat function.

    For example, if you drag a picture from IE to a picture box you can get the
    data in 3 ways:

    1) The image as a DIB
    2) The image filename (in the IE cache)
    3) The HTML tag

    Private Sub Picture1_OLEDragDrop(Data As DataObject, Effect As Long, Button
    As Integer, Shift As Integer, X As Single, Y As Single)
    Dim HTMLTag As String, lCF_HTML As Long
    Dim CF_HTML As Integer

    lCF_HTML = RegisterClipboardFormat("HTML Format")

    MoveMemory CF_HTML, lCF_HTML, 2

    Set Picture1.Picture = Data.GetData(vbCFDIB)
    MsgBox "The cached file is " & Data.Files(1)
    MsgBox "HTML Format: " & vbCrLf & StrConv(Data.GetData(CF_HTML),
    vbUnicode)

    End Sub

    BTW, data dragged & dropped from Outlook Express supports the following
    formats:

    Outlook Express Messages
    FileGroupDescriptor
    FileGroupDescriptorW
    FileContents

    If only 1 message is dragged it also supports:

    Internet Message (rfc822/rfc1522)
    CF_UNICODETEXT
    vbCFText


    HTH

    --
    Eduardo A. Morcillo
    http://www.domaindlx.com/e_morcillo







  5. #5
    Pino Carafa Guest

    Re: OLE drag & drop from Outlook / Outlook express?

    Hello Eduardo,

    It helps.... but I shamefacedly admit that most of your post went straight
    over my head.

    Yes, I'm using manual drop mode alright, but I'm not sure how to proceed
    from there...

    "data dragged & dropped from Outlook Express supports the following
    formats:

    Outlook Express Messages
    FileGroupDescriptor
    FileGroupDescriptorW
    FileContents"

    What are the values of those Format IDs? Where can I find out this sort of
    information?

    Let's say I use GetData for Outlook Express Messages..... How?

    Sorry, I'm a complete ignoramus in this area of VB programming, so I hope
    you'll be able to help me with an idiot's guide... or some references where
    I can read up on this stuff.

    Thanks

    Pino


    Eduardo A. Morcillo <edanmo@geocities.com> wrote in message
    news:38eca1a0@news.devx.com...
    If you are using the automatic drop mode, VB only gets the data supported by
    the target control (text and imag es).

    Using manual mode you can get the data on any format that the data supports
    (even formats not supported by VB) using the GetData method. The only thing
    you need is the format ID. To check if the data supports a format you have
    to use Data.GetFormat function.

    For example, if you drag a picture from IE to a picture box you can get the
    data in 3 ways:

    1) The image as a DIB
    2) The image filename (in the IE cache)
    3) The HTML tag

    Private Sub Picture1_OLEDragDrop(Data As DataObject, Effect As Long, Button
    As Integer, Shift As Integer, X As Single, Y As Single)
    Dim HTMLTag As String, lCF_HTML As Long
    Dim CF_HTML As Integer

    lCF_HTML = RegisterClipboardFormat("HTML Format")

    MoveMemory CF_HTML, lCF_HTML, 2

    Set Picture1.Picture = Data.GetData(vbCFDIB)
    MsgBox "The cached file is " & Data.Files(1)
    MsgBox "HTML Format: " & vbCrLf & StrConv(Data.GetData(CF_HTML),
    vbUnicode)

    End Sub

    BTW, data dragged & dropped from Outlook Express supports the following
    formats:

    Outlook Express Messages
    FileGroupDescriptor
    FileGroupDescriptorW
    FileContents

    If only 1 message is dragged it also supports:

    Internet Message (rfc822/rfc1522)
    CF_UNICODETEXT
    vbCFText


    HTH

    --
    Eduardo A. Morcillo
    http://www.domaindlx.com/e_morcillo







  6. #6
    Eduardo A. Morcillo Guest

    Re: OLE drag & drop from Outlook / Outlook express?


    > Outlook Express Messages
    > FileGroupDescriptor
    > FileGroupDescriptorW
    > FileContents"
    >
    > What are the values of those Format IDs?


    You get them using RegisterClipboardFormat (WARNING! clipboard format
    returns a long but you need an integer)

    Dim lFormat As Long, CF_FileGroupDescriptor As Integer

    lFormat = RegisterClipboardFormat("FileGroupDescriptor")
    MoveMemory CF_FileGroupDescriptor, lFormat, 2

    > Where can I find out this sort of
    > information?


    Using the IDataObject interface you can enumerate what format are supported
    for the dropped data. To get the IDataObject interface from the VB
    DataObject class check the Tips page on my site.

    > Let's say I use GetData for Outlook Express Messages..... How?


    Well, I don't know what kind of data is returned with that format, but it
    has to be something like this (never tried so it can fail):

    Dim vData As Variant
    Dim lFormat As Long, CF_OutlookExpressMessages As Integer

    lFormat = RegisterClipboardFormat("Outlook Express Messages")
    MoveMemory CF_OutlookExpressMessages , lFormat, 2

    vData = Data.GetData(CF_OutlookExpressMessages)

    > Sorry, I'm a complete ignoramus in this area of VB programming, so I hope
    > you'll be able to help me with an idiot's guide... or some references

    where
    > I can read up on this stuff.


    On the MSDN. But you can read about the IDataObject.

    --
    Eduardo A. Morcillo
    http://www.domaindlx.com/e_morcillo




  7. #7
    Eduardo A. Morcillo Guest

    Re: OLE drag & drop from Outlook / Outlook express?


    > Outlook Express Messages
    > FileGroupDescriptor
    > FileGroupDescriptorW
    > FileContents"
    >
    > What are the values of those Format IDs?


    You get them using RegisterClipboardFormat (WARNING! clipboard format
    returns a long but you need an integer)

    Dim lFormat As Long, CF_FileGroupDescriptor As Integer

    lFormat = RegisterClipboardFormat("FileGroupDescriptor")
    MoveMemory CF_FileGroupDescriptor, lFormat, 2

    > Where can I find out this sort of
    > information?


    Using the IDataObject interface you can enumerate what format are supported
    for the dropped data. To get the IDataObject interface from the VB
    DataObject class check the Tips page on my site.

    > Let's say I use GetData for Outlook Express Messages..... How?


    Well, I don't know what kind of data is returned with that format, but it
    has to be something like this (never tried so it can fail):

    Dim vData As Variant
    Dim lFormat As Long, CF_OutlookExpressMessages As Integer

    lFormat = RegisterClipboardFormat("Outlook Express Messages")
    MoveMemory CF_OutlookExpressMessages , lFormat, 2

    vData = Data.GetData(CF_OutlookExpressMessages)

    > Sorry, I'm a complete ignoramus in this area of VB programming, so I hope
    > you'll be able to help me with an idiot's guide... or some references

    where
    > I can read up on this stuff.


    On the MSDN. But you can read about the IDataObject.

    --
    Eduardo A. Morcillo
    http://www.domaindlx.com/e_morcillo




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center