很不理解,请高手帮助

stonexz 2006-07-22 10:28:32
//定义读卡程序
[DllImport("Mwic_32.dll",EntryPoint="asc_asc",CallingConvention=CallingConvention.StdCall)]
public static extern int asc_asc(ref string source, ref string dest, ulong length);
[DllImport("Mwic_32.dll",EntryPoint="asc_hex",CallingConvention=CallingConvention.StdCall)]
public static extern int asc_hex(ref string ascc, ref string hex ,ulong length);
[DllImport("Mwic_32.dll",EntryPoint="hex_asc",CallingConvention=CallingConvention.StdCall)]
public static extern int hex_asc(string hex,ref string ascc, ulong length);

定义以上的读卡程序后,下面进行读卡时就提示错误
//测试一下程序
string ls_hex;
ls_hex="123456";
string ls2="FFFFFF";
int ic_re=100;
ic_re=hex_asc(ls_hex,ref ls2,3);
MessageBox.Show(ls_hex);
MessageBox.Show(ls2);
MessageBox.Show(ic_re.ToString());
错误提示:
未处理的“System.NullReferenceException”类型的异常出现在 WindowsApplication1.exe 中。

其他信息: 未将对象引用设置到对象的实例。
很不明白!!
...全文
60 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
mmcl 2006-07-23
  • 打赏
  • 举报
回复
看一下是不是用了没有初始化的对象
zyxiaola 2006-07-23
  • 打赏
  • 举报
回复
?

___________________________________
免费ASP.NET空间申请http://www.kingtoo.com/pdtshw/hstshw/index.asp,
支持ASP.NET1.1, 2.0
100M asp.net 空间只要50元(www.kingtoo.com)
Knight94 2006-07-23
  • 打赏
  • 举报
回复
dll的函数原型是什么,哪个函数出现问题

110,534

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧