主题:为什么取不到内存值?
Public Class Form1
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal hwnd As String, ByVal lpText As String) As Integer
Public Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Integer, ByRef lpdwProcessId As Integer) As Integer
Public Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Integer, ByVal bInheritHandle As Integer, ByVal dwProcessId As Integer) As Integer
Public Const PROCESS_ALL_ACCESS = &H1F0FFF
Public Declare Function ReadProcessMemory Lib "kernel32.dll" ( _
ByVal hProcess As Integer, _
ByVal lpBaseAddress As Integer, _
ByRef lpBuffer() As Byte, _
ByVal nSize As Integer, _
ByRef lpNumberOfBytesWritten As Integer) As Integer
Public Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Integer) As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim jb As Integer
Dim pid As Integer
Dim hProcess As Integer
Dim bufferr(10) As Byte
Dim readnumber As Integer
jb = FindWindow("Sword3 Class", Nothing)
GetWindowThreadProcessId(jb, pid)
hProcess = OpenProcess(PROCESS_ALL_ACCESS, 0, pid)
ReadProcessMemory(hProcess, &HC0890C0, bufferr, bufferr.Length, readnumber)
TextBox1.Text = System.Text.Encoding.Default.GetString(bufferr)//错在这,提示“数组不能为空”
我在 局部变量 里看到,bufferr的值为Nothing,
为什么??
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal hwnd As String, ByVal lpText As String) As Integer
Public Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Integer, ByRef lpdwProcessId As Integer) As Integer
Public Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Integer, ByVal bInheritHandle As Integer, ByVal dwProcessId As Integer) As Integer
Public Const PROCESS_ALL_ACCESS = &H1F0FFF
Public Declare Function ReadProcessMemory Lib "kernel32.dll" ( _
ByVal hProcess As Integer, _
ByVal lpBaseAddress As Integer, _
ByRef lpBuffer() As Byte, _
ByVal nSize As Integer, _
ByRef lpNumberOfBytesWritten As Integer) As Integer
Public Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Integer) As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim jb As Integer
Dim pid As Integer
Dim hProcess As Integer
Dim bufferr(10) As Byte
Dim readnumber As Integer
jb = FindWindow("Sword3 Class", Nothing)
GetWindowThreadProcessId(jb, pid)
hProcess = OpenProcess(PROCESS_ALL_ACCESS, 0, pid)
ReadProcessMemory(hProcess, &HC0890C0, bufferr, bufferr.Length, readnumber)
TextBox1.Text = System.Text.Encoding.Default.GetString(bufferr)//错在这,提示“数组不能为空”
我在 局部变量 里看到,bufferr的值为Nothing,
为什么??