VB中 FindWindow的用法
请您帮我看一下这个代码DimhwdAsLong'储存FindWindow函数返回的句柄DimpidAsLongDimhProcessAsLong'存放进程句柄DimidA...
请您帮我看一下这个代码Dim hwd As Long ' 储存 FindWindow 函数返回的句柄
Dim pid As Long
Dim hProcess As Long '存放进程句柄
Dim id As Long
Const call_ft = &H4596E9 '飞天地址
Const call_cq = &H403E29 '穿墙地址408254
Const call_bq = &H6BDCF8 '多表情地址
Private Sub Check1_Click()
hwd = FindWindow(vbNullString, "Element Client") '获取进程句柄
GetWindowThreadProcessId hwd, pid '获取进程的PID值
hProcess = OpenProcess(PROCESS_ALL_ACCESS, 0, pid) '以系统做高权限打开进程
If Check1.Value = 1 Then
If hProcess Then
WriteProcessMemory hProcess, ByVal call_ft, -846528150, 4, 0&
CloseHandle hProcess
End If
Else
If hProcess Then
WriteProcessMemory hProcess, ByVal call_ft, -846525846, 4, 0&
CloseHandle hProcess
End If
End If
End Sub
Private Sub Check2_Click()
hwd = FindWindow(vbNullString, "Element Client") '获取进程句柄
GetWindowThreadProcessId hwd, pid '获取进程的PID值
hProcess = OpenProcess(PROCESS_ALL_ACCESS, 0, pid) '以系统做高权限打开进程
If Check2.Value = 1 Then
If hProcess Then
WriteProcessMemory hProcess, ByVal &H403E29, 232311258, 4, 0&
CloseHandle hProcess
End If
Else
If hProcess Then
WriteProcessMemory hProcess, ByVal &H403E29, 232311257, 4, 0&
CloseHandle hProcess
End If
End If
End Sub
Private Sub Check3_Click()
hwd = FindWindow(vbNullString, "Element Client") '获取进程句柄
GetWindowThreadProcessId hwd, pid '获取进程的PID值
hProcess = OpenProcess(PROCESS_ALL_ACCESS, 0, pid) '以系统做高权限打开进程
If Check3.Value = 1 Then
If hProcess Then
WriteProcessMemory hProcess, ByVal call_bq, -1878505335, 4, 0&
CloseHandle hProcess
End If
Else
If hProcess Then
WriteProcessMemory hProcess, ByVal call_bq, -1769273207, 4, 0&
CloseHandle hProcess
End If
End If
End Sub
Private Sub Command1_Click()
End Sub
Private Sub Form_Load()
hwd = FindWindow(vbNullString, "Element Client") '获取进程句柄
If hwd = 0 Then
MsgBox "游戏未运行", vbOKOnly, "提示"
Unload Form1 '假设句柄不存在(即其值为0)弹出对话框提示,并且不载如窗体
End If
GetWindowThreadProcessId hwd, pid '获取进程的PID值
hProcess = OpenProcess(PROCESS_ALL_ACCESS, 0, pid) '以系统做高权限打开进程
If hProcess = 0 Then
MsgBox "不能打开进程", vbOKOnly, "提示"
Unload Form1 '如果无法打开进程,弹出对话框提示同时不载入窗体(和退出一样)
End If
CloseHandle hProcess '关闭进程
End Sub
拿到了 展开
Dim pid As Long
Dim hProcess As Long '存放进程句柄
Dim id As Long
Const call_ft = &H4596E9 '飞天地址
Const call_cq = &H403E29 '穿墙地址408254
Const call_bq = &H6BDCF8 '多表情地址
Private Sub Check1_Click()
hwd = FindWindow(vbNullString, "Element Client") '获取进程句柄
GetWindowThreadProcessId hwd, pid '获取进程的PID值
hProcess = OpenProcess(PROCESS_ALL_ACCESS, 0, pid) '以系统做高权限打开进程
If Check1.Value = 1 Then
If hProcess Then
WriteProcessMemory hProcess, ByVal call_ft, -846528150, 4, 0&
CloseHandle hProcess
End If
Else
If hProcess Then
WriteProcessMemory hProcess, ByVal call_ft, -846525846, 4, 0&
CloseHandle hProcess
End If
End If
End Sub
Private Sub Check2_Click()
hwd = FindWindow(vbNullString, "Element Client") '获取进程句柄
GetWindowThreadProcessId hwd, pid '获取进程的PID值
hProcess = OpenProcess(PROCESS_ALL_ACCESS, 0, pid) '以系统做高权限打开进程
If Check2.Value = 1 Then
If hProcess Then
WriteProcessMemory hProcess, ByVal &H403E29, 232311258, 4, 0&
CloseHandle hProcess
End If
Else
If hProcess Then
WriteProcessMemory hProcess, ByVal &H403E29, 232311257, 4, 0&
CloseHandle hProcess
End If
End If
End Sub
Private Sub Check3_Click()
hwd = FindWindow(vbNullString, "Element Client") '获取进程句柄
GetWindowThreadProcessId hwd, pid '获取进程的PID值
hProcess = OpenProcess(PROCESS_ALL_ACCESS, 0, pid) '以系统做高权限打开进程
If Check3.Value = 1 Then
If hProcess Then
WriteProcessMemory hProcess, ByVal call_bq, -1878505335, 4, 0&
CloseHandle hProcess
End If
Else
If hProcess Then
WriteProcessMemory hProcess, ByVal call_bq, -1769273207, 4, 0&
CloseHandle hProcess
End If
End If
End Sub
Private Sub Command1_Click()
End Sub
Private Sub Form_Load()
hwd = FindWindow(vbNullString, "Element Client") '获取进程句柄
If hwd = 0 Then
MsgBox "游戏未运行", vbOKOnly, "提示"
Unload Form1 '假设句柄不存在(即其值为0)弹出对话框提示,并且不载如窗体
End If
GetWindowThreadProcessId hwd, pid '获取进程的PID值
hProcess = OpenProcess(PROCESS_ALL_ACCESS, 0, pid) '以系统做高权限打开进程
If hProcess = 0 Then
MsgBox "不能打开进程", vbOKOnly, "提示"
Unload Form1 '如果无法打开进程,弹出对话框提示同时不载入窗体(和退出一样)
End If
CloseHandle hProcess '关闭进程
End Sub
拿到了 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询