托管调试助手“PInvokeStackImbalance”在“C:\Documents and Settings\Administrator\桌面\KJ279_MMS_LED.NET\MMS\bin\Release\MMS.exe”中检测到故障。
其他信息: 对 PInvoke 函数“MMS!MMS.LED_Interface::MakeRoot”的调用导致堆栈不对称。原因可能是托管的 PInvoke 签名与非托管的目标签名不匹配。请检查 PInvoke 签名的调用约定和参数与非托管的目标签名是否匹配。[DllImport("LEDSender.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "MakeRoot", SetLastError = true, CharSet = CharSet.Unicode, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
//[DllImport("LEDSender.dll", EntryPoint = "MakeRoot", ExactSpelling = false)]
public extern static long MakeRoot(long RootType, long ScreenType);需要动态链接库的我可以把dll发到邮箱

解决方案 »

  1.   

    调用的代买刚才写错了,以下几种方式我都试过
    [DllImport("LEDSender.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "MakeRoot", SetLastError = true, CharSet = CharSet.Unicode, ExactSpelling = true)][DllImport("LEDSender.dll")]
    [DllImport("LEDSender.dll", EntryPoint = "MakeRoot", SetLastError = true, CharSet = CharSet.Unicode, ExactSpelling = true)][DllImport("LEDSender.dll", EntryPoint = "MakeRoot", ExactSpelling = true)]但是还是有错,大家帮帮忙
      

  2.   

    问题已经解决了,原来是接口参数的定义问题,c++的long 是32位,C#的long是64位,引起这种bug 改成Int32就好了。大家以后引以为戒吧大家对没有奖励的帖子很漠然啊
      

  3.   

    我试了 我用VB.NET(VS2005)调用
        '调用系统函数 鼠标事件函数
        Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
        '调用系统函数 将鼠标移动到相应位置
        Declare Sub SetCursorPos Lib "user32" (ByVal x As Integer, ByVal y As Integer)
    这2个API的是很也遇到这样的问题,但是用楼主的方法解决不了,请高手指教
    我是这样调用的:
    mouse_event(MOUSEEVENTF_RIGHTDOWN, 100, 100, 0, 0)