有关写内存的问题
那6个API我就不贴出来了
Private Sub Command1_Click()
Dim hwnd As Long ' 储存 FindWindow 函数返回的句柄
Dim pid As Long ' 储存进程标识符( Process Id )
Dim pHandle As Long ' 储存进程句柄
' 首先取得目标窗口的句柄
hwnd = FindWindow(vbNullString, "计算器")
If (hwnd = 0) Then
MsgBox "未启动"
Exit Sub
End If
' 取得进程标识符
GetWindowThreadProcessId hwnd, pid
' 使用进程标识符取得进程句柄
pHandle = OpenProcess(PROCESS_ALL_ACCESS, False, pid)
If (pHandle = 0) Then
MsgBox "得不到窗口进程信息" '运行程序老师得不到窗口进程信息,pHandle=0
Exit Sub
End If
' 在内存地址中写入数据
WriteProcessMemory pHandle, &H4603F0C, "3", 1, 0&
' 关闭进程句柄
CloseHandle hProcess
End Sub
[此贴子已经被作者于2006-1-20 18:53:15编辑过]