请问有谁开发过新中新校园一卡通读卡器,为什么我总是初始化失败呢?
我是这样调用的
[DllImport("AIO_API.dll", EntryPoint = "TA_CRInit")]
public static extern int TA_CRInit(char CardReaderType,int port,long Baud_Rate);
然后在按钮里写的:
int nRet = 0;
nRet=TA_CRInit('0',0,19200);
返回值:-1219,读卡器初始化失败
请问怎么回事啊?有人知道吗?谢谢!
------解决方案--------------------[DllImport("AIO_API.dll", EntryPoint = "TA_CRInit")]
public static extern int TA_CRInit(
int CardReaderType,int port,long Baud_Rate);
------解决方案--------------------回答太多遍了,
c++ 的long 是.net int
------解决方案--------------------/// <summary>
/// 初始化读卡器
/// </summary>
/// <param name="CardReaderType">读卡器类型0为USB,1为串口</param>
/// <param name="port">端口号</param>
/// <param name="Baud_Rate">波特率</param>
/// <returns></returns>
[DllImport("AIO_API.dll")]
private static extern int TA_CRInit(int CardReaderType, Int32 port, Int32 Baud_Rate);
调用:int flag = TA_CRInit(0, 1, 19200);
读卡器插上,执行,初始化成功。。。。