Get dropped object before it gets dropped into a drawing ?

S

SomeNewDev

Hi,

is there any chance of getting an object, which was dropped into
a drawing from an external application ?

Because catching it with the ShapeAddedEventHandler seems to
leave the CF_TEXT object only.

Thanks in advance
 
P

Paul Herber

Hi,

is there any chance of getting an object, which was dropped into
a drawing from an external application ?

Because catching it with the ShapeAddedEventHandler seems to
leave the CF_TEXT object only.

The ShapeAddedEventHandler will provide you automatically with a shape
object. It's nothing to do with ant CF_* item, they are for the
clipboard. Drag and drop doesn't use the clipboard.

I'll do a quick check here on how to read your first sentence, I
assume the comma is in the correct place as without it it can be read
differently.
You want to "get an object (which was dropped into a drawing from an
external application)"
not
"get an object (which was dropped into a drawing) from an external
application".
 
S

SomeNewDev

Hi Paul,

sry for my english and thanks for your reply.
You are able to drop many kinds of objects into a visio drawing..
from outside of visio, right ? I mean things like PDF files, Excel files or
any other files (which will at least be shown as icon in the drawing).

And visio somehow reacts on every (from outside) dropped object,
and converts it into a shape. Now I've got a custom drag+drop object
in my own application, and I was trying to get exactly that object
in my visio add-in. It works by default (without any add-in from my side)
in Office Word or Excel, but in Visio I get a 'string-only' shape and that's
it.

I was hoping, that I could catch for example the IDataObject of the
DragEventArgs
class or something similar, in order to monitor dropped objects. Because
the drop object from my own application is NOT just a string like shown in
visio.

Thanks in advance
 
P

Paul Herber

Hi Paul,

sry for my english and thanks for your reply.
You are able to drop many kinds of objects into a visio drawing..
from outside of visio, right ? I mean things like PDF files, Excel files or
any other files (which will at least be shown as icon in the drawing).

And visio somehow reacts on every (from outside) dropped object,
and converts it into a shape. Now I've got a custom drag+drop object
in my own application, and I was trying to get exactly that object
in my visio add-in. It works by default (without any add-in from my side)
in Office Word or Excel, but in Visio I get a 'string-only' shape and that's
it.

I was hoping, that I could catch for example the IDataObject of the
DragEventArgs
class or something similar, in order to monitor dropped objects. Because
the drop object from my own application is NOT just a string like shown in
visio.

I don't know what you mean by a "string-only" shape. Do you mean one
of the drag and drop formats? You will get a shape. Anything and
everything on the page is a Visio shape, however, your shape may
contain the dropped object.
 
S

SomeNewDev

Hi,

I meant the CF_TEXT format. My drag n drop object (from my extern app)
comes with 3 formats: CF_TEXT and 2 custom ones.
One of my custom ones consists of a HTML link - MS Word displays it
correct as a clickable link, when you drop it into a document.
But Visio only takes the CF_TEXT format and converts it into a 'text-only'
shape. And can't see any other formats in the Shape-Object, after a drop
has occured (I'm in ShapeAddedEvent). And Visio doesn't share the
IDataObject of the DragEventArgs, so that I would be able to sort it out
on my own.

Meanwhile I even tried setting a hook on WinEvents to get the IDataObject
of the Drag/Drop action. I used WinAPI's 'SetWinEventHook' with consts
like 'EVENT_SYSTEM_DRAGDROPSTART'. I can hook all kinds of WinEvents
in Visio, but not for the Drag/Drop stuff :\
After some more googling, nobody got those EVENT_SYSTEM_DRAGDROPSTART
events working anyway.

Furtheron I would be able to set hooks with 'SetWindowsHookEx' and
WH_GETMESSAGE as const. But there's only WM_DROPFILES, which wouldn't
do the job anyway.

SCENARIO:
On one side there's Visio and on the other side there's my application.
In my application there's a listview with items in it. The items hold
several informations (not only 1 string !!). I want to drag and drop
items from my listview into a Visio drawing. The Shape-Data has to
be filled with all informations of the items of my listview.

Maybe somebody could point me into the right direction please ?
I'm sure some people tried on it or at least had the wish to do so ?

Thanks in advance.
 
S

SomeNewDev

Maybe this makes my problem somewhat clearer:

-Type any word in 'MS Word' and add a hyperlink to that word.
-Drag that word into a Visio drawing.
=> The hyperlink is lost !

thanks
 
P

Paul Herber

Maybe this makes my problem somewhat clearer:

-Type any word in 'MS Word' and add a hyperlink to that word.
-Drag that word into a Visio drawing.
=> The hyperlink is lost !

Correct, it is only text, the hyperlink aspect is only Word's internal
formatting, Visio cannot see that. Word and Visio handle hyperlinks
very differently
Internally Word will do something like
<hyperlink start marker> the text <end hyperlink>

Visio hyperlinks are based on a shape, it cannot do hyperlinks within
text.
 
S

SomeNewDev

Paul Herber said:
Visio cannot see that.


Yes, I fully understand that, and I got no direct problem with it.
I'm generally after getting data from my external app into
Viso by drag n' drop.

So is this approach a deadend ?

Thanks
 
P

Paul Herber

Yes, I fully understand that, and I got no direct problem with it.
I'm generally after getting data from my external app into
Viso by drag n' drop.

So is this approach a deadend ?

Well, as nobody else has said otherwise then I guess so.
But, as I said earlier, if you use the shapeAdded event caused by the
Drop then have a look at the data available, it might be there. Try
it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top