Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2010-11-16
4
Medium Priority
?
520 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 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
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.

926 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