C#调用MFC的ocx,如何传递数组指针而不是引用?
===========================
MFC ActiveX 生成的ocx,其中的调度接口函数定义如下:
===========================
- C/C++ code
//目的是想实现无符号型字符串数组的传递LONG CSCardFunCtrl::CardFunction(BYTE* reader, BYTE* pinstr, LONG inlen, BYTE* poutstr, LONG* poutlen)
===========================
C#引用了该ocx组建之后,将方法对应成:
===========================
- C# code
public virtual int CardFunction(ref byte reader, ref byte pinstr, int inlen, ref byte poutstr, ref int poutlen);
这样导致,调用时,只能传递一个byte,而不是一个byte[]数组;
请问如何传递byte[]?
C#中byte[]所对应ocx中的数据类型是什么?
分不够可以再加,请大家帮忙解答下!
[解决办法]
- C# code
public virtual int CardFunction(ref byte[] reader, ref byte[] pinstr, int inlen, ref byte[] poutstr, ref int poutlen);
[解决办法]
你对byte的参数进行分配了吗?
看看ocx的参数类型,是in还是out呢?