How to determine a C# class in C++ code

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Juri

    How to determine a C# class in C++ code

    Hi,
    I have a .NET control hosted in a CWinFormsView. In the CWinFormsView I have enabled events in the .NET control to callback to a method in the CWinFormsView by using the BEGIN_DELEGATE_ MAP macro. Everything works just fine, the native method is called properly:
    Code:
    void CGraphControlView::ObjectDoubleClicked(System::Object^ sender, Northwoods::Go::GoObjectEventArgs^ e)
    {
    	TRACE(_T(" Graph object double clicked\n"));
    }
    Now, since I am not so familiar in writing mixed mode applications, my question is:
    - How to determine if the class of the Object returned by the EventArgs handler is of a specific class inherited from System::Object, e.g.
    Code:
    	public class GraphNode : Object
    Code:
    void CGraphControlView::ObjectDoubleClicked(System::Object^ sender, Northwoods::Go::GoObjectEventArgs^ e)
    {
    	TRACE(_T(" Graph object double clicked\n"));
    	// I would like to add something like
    	if (e->Object is a type of GraphNode)
    		DoSomething ....
    	else if (e->Object is a type of SomeOtherObject)
    		DoSomethingElse ....
    }
    Help would be appreciated?
    /Juri
Working...