Hi All!
I have a managed class-wrapper in C++ which calls a C# application and setups event delegates. Problem is in that I get System::Object objects from C# application, but erapper still needs to pass this objects to upper, unmanaged class as variant objects.
Here the short example:
bool CMClass::GetCurrentRowFieldValue(const CString& a_rsFieldName, _variant_t& a_rvtValue) { try { System::Object* oValue; oValue = new System::Object(); a_rvtValue.Clear(); // Call the C# object. VARIANT_BOOL vbGet = m_spManager->GetCurrentRowFieldValue( (PCTSTR)a_rsFieldName, &oValue); // .... // Here I have to convert oValue from Object to variant type and // assign result to a_rvtValue... } catch (const _com_error& a_rErr) { //... } return true; } |

System::Object to Variant in mixed C++
Mougenot
amal02
Read this very good article. As far as I remember there is a sample of an enumerator that has to be delivered to unmanaged code. This is a similar problem like yours:
http://www.codeproject.com/dotnet/cominterop.asp df=100&forumid=1990&exp=0&select=739363