Category : interop

Here is my sample code to describe the flow C# [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)] public struct CppStruct { public int n; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 16)] public string data; } C++ struct struct CppData { int N; char Data[16]; }; C# pass a delegate to C++ public delegate void Get(ref int count, out ..

Read more

I have a problem when calling an OCX method using C#. OCX component is developed in C++. I get this error: "System.Runtime.InteropServices.COMException (0x80020005): Los tipos no coinciden. (Excepci├│n de HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH))rn en System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)rn en MFCActiveXControl1Lib._DMFCActiveXControl1.LeoCadena(IntPtr nombreFichero, IntPtr contenidoFichero, Int32 LongitudFichero)rn en AxMFCActiveXControl1Lib.AxMFCActiveXControl1.LeoCadena(IntPtr nombreFichero, IntPtr contenidoFichero, ..

Read more