当前位置:编程学习 > C#/ASP.NET >>

vb.net 调用二维码“dll_camera.dll”程序集,引发“PInvokeStackImbalance was detected”错误

 Public Declare Function StartDevice Lib "dll_camera.dll" () As Boolean
    '2:      .bool(StartDevice())
    '参数:     无()
    '函数功能:启动设备。
    '返回值:true 设备启动成功
    '        false设备启动失败() 


Public Declare Sub setBarcode Lib "dll_camera.dll" (ByVal bbarcode As Boolean)
    '6.void setBarcode(bool bbarcode)
    '参数:bbarcode, true时,一维引擎开启;false时一维引擎关闭
    '函数功能:设置一维引擎状态
    '返回值:无

'启动设备
                Dim flag = Dll_Camera.StartDevice()
                If flag = False Then
                    MessageBox.Show("设备启动失败")
                End If

上面的StartDevice函数可以正常的运行, 

               '设置一维
                Dll_Camera.setBarcode(True)
                '设置qr
                Dll_Camera.setQRable(True)
                '设置dm
                Dll_Camera.setDMable(True)


   上面的setBarcode, setQRable, setDMable就不行!     DLL程序集在C#中也可以正常的调用! 在vb.net就这样了!    麻烦高手帮我看看!

二维码 vb.net DLL程序集 --------------------编程问答-------------------- 当运行到注释“出错”处时出现以下问题:
PInvokeStackImbalance was detected

A call to PInvoke function 'Tester!Tester.Form1::GetWindow' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.

侦测到调用堆栈失衡
对函数GetWindow的调用使堆栈失衡。原因可能是"managed PInvoke signature"与"unmanaged target signature"不匹配。确认"PInvoke signature"的调用规则和参数与目标"unmanaged signature"匹配。
补充:.NET技术 ,  VB.NET
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,