Convert C# object To VARIANT of type binary format( VT_UI1+VT_ARRAY)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dileepsree
    New Member
    • Dec 2009
    • 2

    Convert C# object To VARIANT of type binary format( VT_UI1+VT_ARRAY)

    My aim is :- Pass C# object as a parameter of unmanaged Dll(vc++ 6.0)

    method . with in the unmaaged dll methedod construct similar C++ class instance .
    vice versa from dll method argument VARIANT result has to be converted to C# object

    For this , I tried
    Marshal.GetNati veVariantForObj ect(s, p);
    or
    Marshal.Structu reToPtr(segInfo , ptrValue, false);

    and
    Marshal.GetObje ctForNativeVari ant(res)



    But I got the error as like
    An invalid VARIANT was detected during a conversion from an unmanaged VARIANT to a managed object. Passing invalid VARIANTs to the CLR can cause unexpected exceptions, corruption or data loss.


    Source Files are attached
    TestOne.zip is the VC++(6.0) unmanaged dll
    TestACallFromDl l.zip is C# application

    Let me help as early as possible ....

    Thanks In advance .

    Regards,
    Dileep S
    Attached Files
Working...