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

来源:百度知道 编辑:UC知道 时间:2024/05/31 21:51:32
这几天无聊想用VB写个游戏挂,其实就是帮忙按键盘- -!

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

求高手指点下

要详细点啊 我是新手!!

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" (