Private Sub Command1_Click() '确定按键
Shell ("123.exe") '调用程序
Call gethwnd("crackme002") '打开程序
WriteProcessMemory pHandle, &H401595, 47, 1, 0& '写入内存
CloseHandle pHandle别 '关闭句柄
End Sub
Private Sub gethwnd(proname As String)
Dim hwnd As Long
hwnd = FindWindow(vbNullString, proname) '调用findWindow
GetWindowThreadProcessId hwnd, pid ' 使用进程标识符取得进程句柄
pHandle = OpenProcess(PROCESS_ALL_ACCESS, False, pid) '这的返回值为什么总是0
If (pHandle = 0) Then
MsgBox "Couldn't get a process handle!"
Exit Sub
End If
End Sub