读书人

C#调用c的DLL文件这个方法改如何写呢

发布时间: 2013-03-06 16:20:31 作者: rapoo

C#调用c的DLL文件,这个方法改怎么写呢?有点迷糊
C#调用c的DLL文件,这个方法改如何写呢?有点迷糊 dll c#
[解决办法]
[DllImport("c的动态库.dll")]
public extern static Int32 CommonOpen(IntPtr hwnd,string com_port);

调用时
if(CommonOpen(this.Handle,"COM1")==0)
{...
}
[解决办法]
要用MarshalAs属性来声明
具体参考一下
http://blog.163.com/wxfsnow@126/blog/static/1049536620117541025911/

读书人网 >C#

热点推荐