Solved

VB drag & drop

Posted on 2000-04-06
12
290 Views
Last Modified: 2010-05-02
Hello everybody,

Don't mind my English, i'm a Dutch student.

I'm working on a application, wich has to be able to get drag&drop data from MS Outlook 97,98 and 2000, and from Outlook Express.  It has to filter this data to get the name and mobile phone number field. (Already managed to do this filter for Outlook 97 data)

My question is:

Is it possible to detect the 'owner' of the drag&drop data? So i can see from which Outlook version it comes?
And IF the data comes from Outlook, and not any other application....

This way it would be much easyer to program the filters I want to...

Any help would be very much appreciated.

Marius Timmer
0
Comment
Question by:mtimmer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 3
12 Comments
 
LVL 10

Accepted Solution

by:
caraf_g earned 100 total points
ID: 2689684
Good question.

If you look at the OLEDragDrop method, you won't get much joy. The only format you seem to be able to extract out of the Data parameter is a text string. In Outlook that gives you a "table" of the messages you've selected, in Outlook express it seems you get the full message body. Dragging more than one message makes the Data completely inaccessible.

But AFAICS there doesn't seem to be any way in there to identify the originator of the data...

You'll probably have to do a nasty bit of API hacking about....

I'll go and ask about for you.

Met vriendelijke groet

Pino
0
 

Author Comment

by:mtimmer
ID: 2689836
Thanks,

I'm sorry, but I forgot to tell that I want to extract the data from the Contact folder and Address book only.

I don't know anything about API-coding at all, so that will be a problem to me.

About MS Outlook: it's true that you can only extract a text string. This is exactly what I did, and I made a filter to search for a certain text ('mobiel:') and then split up the string into smaller pieces.

I have not even tried it with Express, but according to you it will get nasty.

Ik hoop dat je me kunt helpen.

Marius
0
 
LVL 10

Expert Comment

by:caraf_g
ID: 2689957
Hallo Marius,

Oeps... dat was net iets te snel! Je hoeft mijn antwoord pas te accepteren als je er helemaal blij mee bent...

I will contact CS to reverse this... I'd be very happy with the 400 points and an "A", but only when I've actually deserved them.

I'll post a link to the CS URL here in a sec... hang on...
0
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 
LVL 10

Expert Comment

by:caraf_g
ID: 2689978
0
 
LVL 3

Expert Comment

by:darinw
ID: 2690623
Hi mtimmer and caraf_g,

There isn't a way to re-open a question once an answer has been accepted. Since caraf_g would like to allow you to re-open the question I have credited your account mtimmer with 100 points to allow you to post a new question.

darinw
Customer Service
0
 
LVL 10

Expert Comment

by:caraf_g
ID: 2690959
Hello mtimmer,

OK, I posted a question for you on a news group in which I also participate. I'll let you know if anything good comes out of it.
0
 

Author Comment

by:mtimmer
ID: 2692342
Thanks again, both darinw an caraf_g

Sorry for the troubles, its my first post, and didn't really understand how this system works.

I'll see whether something comes out of it.
0
 
LVL 10

Expert Comment

by:caraf_g
ID: 2692509
OK - here's some information I got from Eduardo Morcillo in the news.devx.com newsgroup. I'll post it exactly as is.

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



0
 
LVL 10

Expert Comment

by:caraf_g
ID: 2692512
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
0
 
LVL 10

Expert Comment

by:caraf_g
ID: 2692513

> 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


0
 
LVL 10

Expert Comment

by:caraf_g
ID: 2692515
Hope this helps!
0
 

Author Comment

by:mtimmer
ID: 2692726
First of all: thanks for your help,

I will try to implement this.. it looks like it can be very helpful.
But i guess it's going to be a nasty bit of coding..
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question