Solved

VB drag & drop

Posted on 2000-04-06
12
276 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
  • 8
  • 3
12 Comments
 
LVL 10

Accepted Solution

by:
caraf_g earned 100 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
 
LVL 10

Expert Comment

by:caraf_g
Comment Utility
0
 
LVL 3

Expert Comment

by:darinw
Comment Utility
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
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:mtimmer
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility

> 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
Comment Utility
Hope this helps!
0
 

Author Comment

by:mtimmer
Comment Utility
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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…

744 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now