Solved

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

Posted on 2010-11-16
4
515 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 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
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.

626 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