本文介绍了在调用EnumWindows时尝试读取或写入受保护的内存错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试读取或写入受保护的内存.这通常表明其他内存已损坏.,当我调用EnumWindows时.通过主模块从打开我的vb.net.

'全局声明
                                   声明函数EnumWindows Lib"user32" (ByVal x为回调,ByVal y为整数)为Integer
                                   公开代表子CallBack()

  '在主模块中声明的函数
       Public Sub AddProcessReply()

通话功能"

                       昏暗的intAddressOf作为整数
              intAddressOf = EnumWindows(AddressAddProcessReply,0)
             Ret = .Back(intAddressOf)  nbsp; nbsp; ;      //Back函数是vb.net的VC ++函数,我正在传递 函数指针,但出现错误

谢谢..

解决方案


Hi,

I am getting Attempted to read or write protected memory. This is often an indication that other memory is corrupt.while I am calling EnumWindows. Opening my vb.net from through main module

'Globally declare
                 Declare Function EnumWindows Lib "user32" (ByVal x As CallBack, ByVal y As Integer) As Integer
                 Public Delegate Sub CallBack()

  'Function declared in Main module
        Public Sub AddProcessReply()

'Calling function

               Dim intAddressOf As Integer
               intAddressOf = EnumWindows(AddressOf AddProcessReply, 0)
               Ret = .Back(intAddressOf)               // Back function is VC++ function from vb.net i am passing function pointer but I am getting error

Thanks..

解决方案


这篇关于在调用EnumWindows时尝试读取或写入受保护的内存错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-12 02:48