VB如何利用进程里的PID获得游戏窗口信息?高手指点下!! 50

这几天无聊想用VB写个游戏挂,其实就是帮忙按键盘--!此游戏可多开,我想用PID应该可以找到游戏窗口吧?求高手指点下要详细点啊我是新手!!... 这几天无聊想用VB写个游戏挂,其实就是帮忙按键盘- -!

此游戏可多开,我想用PID应该可以找到游戏窗口吧?

求高手指点下

要详细点啊 我是新手!!
展开
 我来答
百度网友0f3f080f4
2009-08-20 · TA获得超过777个赞
知道小有建树答主
回答量:1055
采纳率:0%
帮助的人:814万
展开全部
  hwdb = FindWindow(vbNullString, "传奇") '读取HWND
  If hwdb <> 0 Then
  If hwdb <> hwd Then
  hwd = hwdb
  ThreadProcessId = GetWindowThreadProcessId(hwd, Pid) '获取进程标识符
  hProcess = OpenProcess(PROCESS_ALL_ACCESS, 0, Pid)
  SetHook
  CloseHandle hProcess
  End If
  End If

  Option Explicit
  '---------------声明函数-----------------------
  '得到窗体句柄的函数,FindWindow函数用来返回符合指定的类名( ClassName )和窗口名( WindowTitle )的窗口句柄
  Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
  '得到窗体控件句柄的函数
  Public 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
  '得到进程标识符的函数
  Public Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long) As Long
  '得到目标进程句柄的函数
  Public Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
  '关闭句柄的函数
  Public Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
  '读取进程内存的函数
  Public Declare Function ReadProcessMemory Lib "kernel32.dll" (ByVal hProcess As Long, ByVal lpBaseAddress As Long, ByRef lpBuffer As Any, ByVal nSize As Long, ByRef lpNumberOfBytesWritten As Long) As Long
  '参数决定了对进程的存储权限,使用完全控制
  Public Const PROCESS_ALL_ACCESS = &H1F0FFF

  Public Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Long, lpBaseAddress As Any, lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long

  Public Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Long

  ' 返回值
  ' Long,成功则返回库模块的句柄,零表示失败。会设置GetLastError
  ' 参数表
  ' 参数 类型及说明
  ' lpLibFileName String,指定要载入的动态链接库的名称。采用与CreateProcess函数的lpCommandLine参数指定的同样的搜索顺序
  ' 注解
  ' 一旦不需要,用FreeLibrary函数释放DLL
  '
  'FreeLibrary
  ' VB声明
  Public Declare Function FreeLibrary Lib "kernel32" (ByVal hLibModule As Long) As Long
  ' 说明
  ' 释放指定的动态链接库,它们早先是用LoadLibrary API函数装载的
  ' 返回值
  ' Long,非零表示成功,零表示失败。会设置GetLastError
  ' 参数表
  ' 参数 类型及说明

  Public Declare Function GetModuleHandle Lib "kernel32" Alias "GetModuleHandleA" (ByVal lpModuleName As String) As Long

  Public Declare Function GetProcAddress Lib "kernel32" (ByVal hModule As Long, ByVal lpProcName As String) As Long
顽皮哈利
2009-08-20 · TA获得超过310个赞
知道小有建树答主
回答量:697
采纳率:100%
帮助的人:431万
展开全部
findwindow
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式