Solved

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

Posted on 2010-11-16
4
505 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
  • 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 250 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

815 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

7 Experts available now in Live!

Get 1:1 Help Now