vb写内存字节集
1、运行“Microsoft Visual Studio 2010”。

2、”vs“的窗口弹出后,找到菜单栏,鼠标左键单击标题为”文件(f)“的选项。

3、在弹出的列表中鼠标左键单击标题为”新建项目(p)“的项。

4、在弹出的标题为”新建项目“,鼠标左键选择标题为”Visual Basic“项,在选择标题为”WIndows“的项。
再在右边的列表中选择标题为”Windows 窗体应用程序“。
再鼠标左键单击标题为”确定“的按钮。

5、在一个背景为”白色"的窗口,且标题为“ForM1”的窗口中的空白处鼠标左键双击。

6、在新切换到的“代码编辑页面”的 “Public Class Form1”下粘贴(写)“API”:
Public Declare Function _打开当前进程 Lib "kernel32" Alias "GetCurrentProcess" () As Integer
Public Declare Function _关闭对象 Lib "kernel32" Alias "CloseHandle" (ByVal jb As Integer) As Integer
Public Declare Function _打开进程 Lib "kernel32" Alias "OpenProcess" (ByVal 访问级别 As Integer, ByVal 子进程继承 As Integer, ByVal 进程ID As Integer) As Integer
Public Declare Function _内存写字节集 Lib "kernel32" Alias "WriteProcessMemory" (ByVal hprocess As Integer, ByVal pbaseaddress As Integer, ByRef lpbuffer() As Byte, ByVal nsize As Integer, ByVal ip As Integer) As Integer

7、再在“
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
”
下写(粘贴)代码:
Function 写内存字节集(ByVal pid As Integer, ByVal 内存地址 As Integer, ByVal 值() As Byte, ByVal 写入长度 As Integer) As Integer
Dim 操作句柄, 临时整数 As Integer
If pid = -1 Then
操作句柄 = _打开当前进程()
End If
If pid <> -1 Then
操作句柄 = _打开进程(2035711, 0, pid)
End If
写内存字节集 = _内存写字节集(操作句柄, 内存地址, 值, 写入长度, 0)
_关闭对象(操作句柄)
End Function

8、最后在“
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
”
字样下写代码:写内存字节集(),第一个进程PID,第二个内存地址,第三个字节数组
再运行测试一下就OK了!!~~!

9、投个票票吧~~!
