游戏开发论坛

 找回密码
 立即注册
搜索
查看: 2087|回复: 7

菜鸟的垃圾代码 请来批评

[复制链接]

16

主题

71

帖子

77

积分

注册会员

Rank: 2

积分
77
发表于 2006-4-15 22:00:00 | 显示全部楼层 |阅读模式
Private Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long
Private Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Const mouseeventf_move = &H1
Private Const mouseeventf_leftdown = &H2
Private Const mouseeventf_leftup = &H4
Private Const mouseeventf_rightdown = &H8
Private Const mouseeventf_rightup = &H10
Private Sub Command1_Click()
Text1.Text = "欢迎使用垃圾API"
Print "呵呵真垃圾"
Call mouse_event(mouseeventf_move, 51, 33, 0, 0)
Call mouse_event(mouseeventf_move, 11, 22, 0, 0)
Call keybd_event(vbKeyE, 69, 0, 0)
Command1.Enabled = False
End Sub



Private Sub Command2_Click()
Command1.Enabled = True
Text1.Text = "学来学去还是垃圾呀,怎么才能把模拟作用于游戏,还是不会使用FINDWINDOW这个函数呀"
End Sub
放进窗体就能使用 [em17] [em17] [em17] [em17]

33

主题

669

帖子

669

积分

高级会员

Rank: 4

积分
669
QQ
发表于 2006-4-16 13:10:00 | 显示全部楼层

Re:菜鸟的垃圾代码 请来批评

多多努力^_^

7

主题

318

帖子

318

积分

中级会员

Rank: 3Rank: 3

积分
318
发表于 2006-4-22 14:12:00 | 显示全部楼层

Re:菜鸟的垃圾代码 请来批评

en

20

主题

451

帖子

470

积分

中级会员

Rank: 3Rank: 3

积分
470
发表于 2006-4-24 06:09:00 | 显示全部楼层

Re:菜鸟的垃圾代码 请来批评

FindWindowEx我没用过,只用过FindWindow,申明和用法如下:
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As Any, ByVal lpWindowName As String) As Long

一个例子:
FindWindow(vbNullString, “World of Warcraft")
如果WoW的客户端开着,那么这个函数就返回WoW客户端窗口的句柄

16

主题

71

帖子

77

积分

注册会员

Rank: 2

积分
77
 楼主| 发表于 2006-4-24 14:44:00 | 显示全部楼层

Re:这个代码我试过很多次只对真封神有作用 对三国无效

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private Declare Sub Sleep Lib "kernel32" (ByVal dwmilliseconds As Long)
Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long) As Long
Private Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Long, ByVal lpBaseAddress As Any, lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long
Private Function ncnr(lpADDress As Long) As Long
Dim hwnd As Long
Dim pid As Long
Dim pHandle As Long
hwnd = FindWindow(vbNullString, "三国群英传OnLine")
hwnd = SetForegroundWindow(hwnd)
GetWindowThreadProcessId hwnd, pid
pHandle = OpenProcess(PROCESS_ALL_ACCESS, False, pid)
ReadProcessMemory pHandle, lpADDress, ByVal VarPtr(ncnr), 4, 0&
CloseHandle hProcess
End Function
Private Function xr(lpADDress As Long, Zhi As Integer) As Integer
Dim hwnd As Long
Dim pid As Long
Dim pHandle As Long
hwnd = FindWindow(vbNullString, "三国群英传OnLine")
hwnd = SetForegroundWindow(hwnd)
GetWindowThreadProcessId hwnd, pid
pHandle = OpenProcess(PROCESS_ALL_ACCESS, False, pid)
WriteProcessMemory pHandle, lpADDress, Zhi, 1, 0&
CloseHandle hProcess
End Function
以上代码是对三国群英传的 这个游戏我正在玩

16

主题

71

帖子

77

积分

注册会员

Rank: 2

积分
77
 楼主| 发表于 2006-4-24 14:49:00 | 显示全部楼层

Re:这个代码我试过很多次只对真封神有作用 对三国无效

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private Declare Sub Sleep Lib "kernel32" (ByVal dwmilliseconds As Long)
Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long) As Long
Private Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Long, ByVal lpBaseAddress As Any, lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long
Private Function ncnr(lpADDress As Long) As Long
Dim hwnd As Long
Dim pid As Long
Dim pHandle As Long
hwnd = FindWindow(vbNullString, "三国群英传OnLine")
hwnd = SetForegroundWindow(hwnd)
GetWindowThreadProcessId hwnd, pid
pHandle = OpenProcess(PROCESS_ALL_ACCESS, False, pid)
ReadProcessMemory pHandle, lpADDress, ByVal VarPtr(ncnr), 4, 0&
CloseHandle hProcess
End Function
Private Function xr(lpADDress As Long, Zhi As Integer) As Integer
Dim hwnd As Long
Dim pid As Long
Dim pHandle As Long
hwnd = FindWindow(vbNullString, "三国群英传OnLine")
hwnd = SetForegroundWindow(hwnd)
GetWindowThreadProcessId hwnd, pid
pHandle = OpenProcess(PROCESS_ALL_ACCESS, False, pid)
WriteProcessMemory pHandle, lpADDress, Zhi, 1, 0&
CloseHandle hProcess
End Function
以上代码是对三国群英传的 这个游戏我正在玩

20

主题

451

帖子

470

积分

中级会员

Rank: 3Rank: 3

积分
470
发表于 2006-4-24 16:22:00 | 显示全部楼层

Re:菜鸟的垃圾代码 请来批评

不懂你要干什么?
取得客户端句柄,然后置于前台,然后打开进程并读取其内存?
想做金山游侠?

16

主题

71

帖子

77

积分

注册会员

Rank: 2

积分
77
 楼主| 发表于 2006-4-24 16:55:00 | 显示全部楼层

Re:菜鸟的垃圾代码 请来批评

倒还以为是外挂代码呢 原来是金山游侠
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

作品发布|文章投稿|广告合作|关于本站|游戏开发论坛 ( 闽ICP备17032699号-3 )

GMT+8, 2026-1-24 07:08

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表