VB.NET是一款功能强大的编程语言。它的出现在很大程度上改变了编程人员编写代码方式,提高了程序开发效率。我们将会在这里为大家介绍一下有关VB.NET读取内存的相关方法,希望能帮助大家对这门语言有一个深刻的了解。
VB/NET读取内存代码示例:
- Private Declare Function OpenProcess
Lib "kernel32.dll" (ByVal dwDesiredAccess
As Integer, ByVal bInheritHandle As
Integer, ByVal dwProcessId As Integer)
As Integer- Public Declare Function ReadProcess
Memory Lib "kernel32" (ByVal hProcess
As Integer, ByVal lpBaseAddress As
Integer, ByVal lpBuffer() As Byte,
ByVal nSize As Integer, ByRef- lpNumberOfBytesWritten As Integer)
As Integer- Private Const PROCESS_VM_READ
As Long = &H10- Private Sub sd()
- Dim ph As Integer
- Dim i As Integer
- Dim h As Integer
- Dim buffer(20) As Byte
- Dim bytesRead As Integer
- '获得进程
- ph = OpenProcess(PROCESS_ALL_
ACCESS, False, 1832)- If ph Then
- MessageBox.Show(True)
- h = ReadProcessMemory(ph, &H403000,
buffer, buffer.Length, bytesRead)- For i = 0 To buffer.Length - 1
- TempMem += buffer(i).ToString
- Next
- Else
- MessageBox.Show(False)
- End If
- End Sub
VB.NET读取内存相关实现方法就为大家介绍到这里。
【编辑推荐】