设备运行时内存损坏 [英] Memory corrupt when device operate

查看:104
本文介绍了设备运行时内存损坏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我创建一个程序来操作设备。该设备是检查接收器。当设备准备接受时,我放置支票,设备将进给。但检查后异常提高尝试读取或写入受保护的内存。这通常表明其他内存已损坏。



如何解决此问题问题。?我接受的代码如下:



Hi all,

I create a program to operate a device. The device is check acceptor. When the device is ready accepting, I place the check and the device will feed. But the exception raise after check is feeding "Attempt to read or write Protected Memory. This is often an indicating that other memory is corrupt".

How to solve this kind of problem.? My code to accept is below:

Public Shared Function StartAccepting(ByVal intTime As Integer) As Boolean
    Dim ret As Boolean
    Dim time As Integer = intTime
    Dim strTmp(300) As Byte
    Dim strStr As String
    Dim enc As New System.Text.ASCIIEncoding()
    Try
        ret = RunAccept(time, strTmp(0))
        strStr = enc.GetString(strTmp)
        If ret Then
            Return True
        Else
            Return False
        End If
    Catch ex As Exception
        MsgBox("Error opening:ExMsg-" & ex.Message)
        Return False
    End Try
End Function







粗体代码后的异常提升。返回后..




Exception raise after the bold code. after it return..

推荐答案

这是您必须联系设备制造商和SDK的地方。这里的任何人都不太可能对您使用的确切设备有任何经验。
This is where you have to contact the manufacturer of your device and the SDK. It's extremely unlikely anyone here is going to have any experience with the exact device you're using.


找到它..当在RunAccept上调用DLL导入时,我将声明作为ByRef。我搜索并发现有人建议改为ByVal。这是工作..
Found it..when calling DLL import on RunAccept, I put the declaration as ByRef. I search and found someone advise to change to ByVal. And it's work..


这篇关于设备运行时内存损坏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆