Connecting Tech Pros Worldwide Forums | Help | Site Map

How do I extract my data from a Drag & Drop ComObject?

Neil West
Guest
 
Posts: n/a
#1: Nov 21 '05
I’m trying to drag & drop listview items between two instances of my app. The
actual data that’s passed in DoDragDrop is an arraylist that’s been
serialized to a memorystream. The contents of the arraylist are objects of a
simple, serializable custom class that allows the recipient listview to
reconstruct the dragged listitems. (the contents of the arraylist actually
don’t matter…they can be simple integers and the issues in this post remain
the same)

When I’m dragging & dropping within an instance of my app, e.Data from the
DragDrop event is a DataObject and I can extract my memorystream, deserialize
it, and I’m good. However, when I drag & drop to another instance of my
application, e.Data is a System.__ComObject. Attempting to extract my data
with the normal e.Data.GetData method results in a memorystream that’s,
according to the Locals window, a
System.Runtime.Remoting.Proxies.__TransparentProxy , which is beyond the scope
of my VB knowledge. Regardless, it doesn’t deserialize, and now I’m stuck.

So could someone kindly explain what I need to do to the __ComObject to get
my memorystream out? Here’s my code:

If e.Data.GetDataPresent("System.IO.MemoryStream") Then
Dim Formatter As New BinaryFormatter
Dim Stream As New System.IO.MemoryStream
Dim DropList As New ArrayList

Stream = e.Data.GetData("System.IO.MemoryStream")
Stream.Position = 0
DropList = Formatter.Deserialize(Stream)


Any help would be appreciated.

Neil


JohnR
Guest
 
Posts: n/a
#2: Nov 21 '05

re: How do I extract my data from a Drag & Drop ComObject?


Hi Neil,

I am having the exact same problem and was disappointed to see that
nobody replied... Did you find a solution that you could share?

John

"Neil West" <NeilWest@discussions.microsoft.com> wrote in message
news:15CF92A7-21FB-4831-9A34-266BBD5DD9D8@microsoft.com...[color=blue]
> I'm trying to drag & drop listview items between two instances of my app.
> The
> actual data that's passed in DoDragDrop is an arraylist that's been
> serialized to a memorystream. The contents of the arraylist are objects
> of a
> simple, serializable custom class that allows the recipient listview to
> reconstruct the dragged listitems. (the contents of the arraylist
> actually
> don't matter.they can be simple integers and the issues in this post
> remain
> the same)
>
> When I'm dragging & dropping within an instance of my app, e.Data from the
> DragDrop event is a DataObject and I can extract my memorystream,
> deserialize
> it, and I'm good. However, when I drag & drop to another instance of my
> application, e.Data is a System.__ComObject. Attempting to extract my
> data
> with the normal e.Data.GetData method results in a memorystream that's,
> according to the Locals window, a
> System.Runtime.Remoting.Proxies.__TransparentProxy , which is beyond the
> scope
> of my VB knowledge. Regardless, it doesn't deserialize, and now I'm
> stuck.
>
> So could someone kindly explain what I need to do to the __ComObject to
> get
> my memorystream out? Here's my code:
>
> If e.Data.GetDataPresent("System.IO.MemoryStream") Then
> Dim Formatter As New BinaryFormatter
> Dim Stream As New System.IO.MemoryStream
> Dim DropList As New ArrayList
>
> Stream = e.Data.GetData("System.IO.MemoryStream")
> Stream.Position = 0
> DropList = Formatter.Deserialize(Stream)
>
>
> Any help would be appreciated.
>
> Neil
>[/color]


Closed Thread