Running a C# from win32 C++ with /clr support

Go To StackoverFlow.com

0

Like in my previous questions, I want to plot a realtime graph for tracking the laser scanner object position. I have developed the algorithm in vs2010 c++ as a win32 application with /clr support. where I find the exact position(x,y) of the object at each scan.But I want the .NET for the GUI purpose. I already used Zedgraph for plotting in c#.Now, I want to call the C# form from c++. I am searching for the answers since yesterday and I found out we can do that using

  1. c++/cli 2. using COM interoperation.

I tried adding the reference of the c# dll inside the c++.But I dont know how to invoke them from c++. I am looking for a document or link for doing either of them from a beginner point of view. Any inputs or suggestions would be helpful.

2012-04-04 08:23
by ShivShambo
what have you tried so far codewise? have you read this - alegen 2012-04-04 08:37
thanks.. I will try it now.. - ShivShambo 2012-04-04 08:59


0

You most probably want to invert your structure here and call the Managed C++ library from your C# GUI. From C# you can instatiate the C++ monitoring object and start taking the readings, receive them and then display the results in the GUI.

2012-04-04 08:40
by Slugart
my C++ is reading real time values from the sensor. Making it as a DLL wil make it static I think. - ShivShambo 2012-04-04 08:57
@lakshmikant what do you mean static? Not real-time? Real-time is not a property of an executable but rather of a program as a whole. There are real-time C# programs for example. C++ code accessed through a Managed C++ interface or PInvoked for that matter will run natively. The only performance hit will be around marshalling the data to managed types but this will happen no matter which direction you push the data - Slugart 2012-04-04 09:03
Ads