thanks for your reply. I solve that propbem. as you said to me, I use that statement...like this.. int Get_Current_Media([MarshalAs(UnmanagedType.LPArray, SizeParamIndex=1)]out byte[]ar, out int len); My C++(dll) module can communicate with c# application perfectly...!!! but speed is so late. approximately spend 0.5 second. So I can't use this method in my c# application. I have a plan to remake application using c++ -_- Anyway I am really thankful to your answer.
neoksd
Posts
-
How can I pass byte array from C++ to c# ? -
How can I pass byte array from C++ to c# ?many thanks for your response. but I have still problem. I also find this answer. but this solution is a little bit different with my problem. In this solution, C++ use C# dll. but in my case C# use C++ dll. Maybe this solution is correct. but I can't solve my problem.... please teach me... thank you. C++: long *ar = new long[8192]; for (i=0; i<8192; i++) ar[i] = i; managed->SetArrayElements(8192, ar); C#: public void SetArrayElements(int len, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex=0)]int[] ar) { int[] bbb = new int[10240]; Array.Copy(ar, 0, bbb, 0, len); Console.WriteLine("Length= {0}, ar[0] = {1}", ar.Length, ar[0]); } --------
-
How can I pass byte array from C++ to c# ?Hi~~ I have a problem transfer byte array from directshow filter to C# application. I made simple directshow filter using C++. that filter has a interface to communication outside application. like this.. DECLARE_INTERFACE_(IGetCurrentData, IUnknown) { STDMETHOD(Get_Current_Media) (THIS_ BYTE** pData ) PURE; STDMETHOD(Get_Current_Media_Legnth) (THIS_ long& length ) PURE; }; I also declare interface in C# application to communicate with filter(C++ Dll) like this.. [ComVisible(true), ComImport, Guid("CCB4EF12-C1CC-43a4-82EF-7886C0F39EB1"), InterfaceType( ComInterfaceType.InterfaceIsIUnknown )] public interface IGetCurrentData { [PreserveSig] int Get_Current_Media([MarshalAs(UnmanagedType.LPArray, SizeParamIndex=0)]out byte[]ar); [PreserveSig] int Get_Current_Media_Legnth(out long length); } I use this sentence to use C# interface. byte[] pData; Get_Current_Media(out pData); but I meet an exception during runtime. I think datatype is not match. How can I solve this problem?
-
how to get and set scrollbar positions of a rich textbox control.?As the title says, I am wondering about how to get and set scrollbar positions of a rich textbox control. I want to make haxa editor using C#. so I used 3 richbox. first richbox displays the line number, second richbox displays Haxa data and the last richbox display ascii code. so all richbox scrolled at same position and at the same time. Does anyone know a method to get and set textbox scrollbar positions?