rbhargaw
asked on
Interop between C# and C++
I have a C# dialog with OK and Cancel button. Now this dialog is called from VC++ code. I wanted to pass a string from C# dialog to C++ which will let us know if the user has clicked OK or Cancel button. I am able to access the defined string in C# to the C++ code but the values are coming as NULL instead of True or False as defined in C#. I wanted to know what could be going wrong and how to achieve this
ASKER
It's a windows form dialog. However I have declared a string name buttonFlag and setting the value as "true" or "false" when the use clicks on the button. Now I need to transfer the button flag string value to C++ application. How can I achieve that?
Have you tried Setting the assembly's property COMVisible=true? This should make your application accessible through COM in C++. Just write the string captions to a reserved Memory (field) and Access it afterwards native.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks Sara, Basically there is C++ Dialog Class To Host a C# control. The C++ host is configuring the C# component by setting properties that it exposes. The C# class can expose events that are handled by the C++ host using the standard .NET event pattern. I am currently working to post a message back and see if that will work. I think thats what you are going into also.
ASKER
Satisfied with explanation
In WPF the DialogResult is a System.Object. It is singalized through a nullable bool if there is a return value at all.
In Windows Forms the DialogResult is a enumeration of the clicked option. There are no string captions of the clicked buttons.