?
Solved

Drag data from C++  (OLE) dialog drop into C# winform

Posted on 2010-11-16
4
Medium Priority
?
518 Views
Last Modified: 2012-05-10
Hi

No response from my original question so I'm reposting with more detail.  Hope it helps.

Having spent a couple of hours trawling throught the net with no sucess, I'm finally posting here with the hopes of some help.

I have a C++ multi dialog application which starts a dragdrop using the OLE RegisterDragDrop.  This application also has handers for the drop on othe dialog pages and everything works fine.  

I am now upgrading this application with a C# winform being attached to a C++ Dialog.  Everything works fine, and is being displayed as intended.

However, I can't get the drop to work from the old C++ (OLE) application to the new C# one.  

When the drop event is fired, I can see the Type of the data is a DataObect but any attempt I've made so far in actually getting the data being dragged has resulted in a null.

Can anyone point me to an example of how to get the data being dragged from an OLE application and being dropped into a C# application.

Hope that's enough info, if not please post and I'll try to provide some more.  I'm just looking for pointers at the moment rather than a solution.

Cheers
Hank
0
Comment
Question by:HankSloka
[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
  • 2
4 Comments
 
LVL 16

Expert Comment

by:George Tokas
ID: 34153554
Why don't you write a description for the data object in a file and when the drop event is fired read that specific file?
Just a quick suggestion...:-)

George Tokas.
0
 

Author Comment

by:HankSloka
ID: 34153649
Thanks George

Unfortunately, even though this is a viable solution, making ANY changes to the existing code would result in a massive regression test in QA which is not an acceptable option.  I really need a way to get at the OLE data being dragged using C#.

Thanks anyway.

Cheers
Hank
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 1000 total points
ID: 34155802
I would be curious what data formats are present when you drag and drop to the Form (e.Data.GetFormats()).
0
 

Author Closing Comment

by:HankSloka
ID: 34162953
Although you didn't actually "solve" my problem, your question put me on the right lines!  I can now get the data into an object by using:-

            string[] frmts = e.Data.GetFormats();
            object o = e.Data.GetData(frmts[0]);

From there I can work on the memory stream and get the data out.

Many thanks :)
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
Suggested Courses

718 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