110,528
社区成员
发帖
与我相关
我的任务
分享
[DllImport("HighPowerDll.dll", CallingConvention = CallingConvention.StdCall)]
public static extern int GetVcell_Index(int Devicechannum, int IndexSs, IntPtr mV);
string mv = 参数mv的值;
byte[] arr = new byte[mv.Length * 2];
Encoding.ASCII.GetBytes(mv, 0, mv.Length, arr, 0);
IntPtr p = Marshal.AllocHGlobal(arr.Length);
Marshal.Copy(arr, 0, p, arr.Length);
GetVcell_Index(第一个参数, 第二个参数, p);
mv = Marshal.PtrToStringAnsi(p);
Marshal.FreeHGlobal(p);