关于dll引入问题 CharSet=CharSet.Unicode如果是ansi的话,直接用string试试 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 应该在Unicode,因为我在vs2010直接就能用,但我在vs2010 的C#里这样写 运行时会出现以下错误, 求修正 [DllImport("LaserTool.dll", EntryPoint = "SAM_LoadTemplate", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.StdCall)] public static extern Int32 SAM_LoadTemplate(StringBuilder str); StringBuilder sbd = new StringBuilder("C:\\demo1.sjf");Laser.SAM_LoadTemplate(sbd);//运行到这里就会停下来提示以下错误 但实际上这个函数已经执行(我已经盾到效果)SAM_LoadTemplate has unbalanced stackbecause the managed PInvoke signature not match unmanagegd target signature 应该是unicode的,因为我在vs2010 的mfc直接就能用但我在c#里如下调用 [DllImport("LaserTool.dll", EntryPoint = "SAM_LoadTemplate", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.StdCall)] public static extern Int32 SAM_LoadTemplate(StringBuilder str); StringBuilder sbd = new StringBuilder("C:\\demo1.sjf"); StringBuilder mbder2 = new StringBuilder(""); Laser.SAM_LoadTemplate(sbd);//执行到这程序就会出错 提示签名不匹配pip #define AFX_SAM_IMPORT extern "C" __declspec(dllimport)加多个说明 stringbuilder或者string 都不行的话 ,试试intptr吧!还是不行的话就unsafe吧,直接用想通格式的指针非安全模式调试下,看看有没错。 C#串口通信 接收不到数据 如何在WebBrowser模拟点击不弹出页面 一个关于数据库的check 约束问题 检测form内,数据变动 请问如何加宽水晶报表? 求助,文件名顺序的问题 c#中,使用框架后,session立即过期是何原因? 被update搞昏了头 MailMessage本人只找到From,即发件人的邮件地址,请问对应的发件人姓名是什么? ####???????-----在线等:Smart Client技术%%%%%%%%%% 正则表达式如何抓取多组数据 C# 怎么打印*.frf报表文件
但我在vs2010 的C#里这样写 运行时会出现以下错误, 求修正
[DllImport("LaserTool.dll", EntryPoint = "SAM_LoadTemplate", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.StdCall)]
public static extern Int32 SAM_LoadTemplate(StringBuilder str); StringBuilder sbd = new StringBuilder("C:\\demo1.sjf");
Laser.SAM_LoadTemplate(sbd);//运行到这里就会停下来提示以下错误 但实际上这个函数已经执行(我已经盾到效果)SAM_LoadTemplate has unbalanced stack
because the managed PInvoke signature not match unmanagegd target signature
但我在c#里如下调用
[DllImport("LaserTool.dll", EntryPoint = "SAM_LoadTemplate", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.StdCall)]
public static extern Int32 SAM_LoadTemplate(StringBuilder str);
StringBuilder sbd = new StringBuilder("C:\\demo1.sjf");
StringBuilder mbder2 = new StringBuilder("");
Laser.SAM_LoadTemplate(sbd);//执行到这程序就会出错 提示签名不匹配pip
加多个说明