游戏开发论坛

 找回密码
 立即注册
搜索
查看: 1473|回复: 1

会VB制作修改器的大侠看看好么

[复制链接]

11

主题

49

帖子

49

积分

注册会员

Rank: 2

积分
49
发表于 2005-12-4 11:03:00 | 显示全部楼层 |阅读模式
按照一个范例进行找窗口读进程的制作,函数代码如下
建立一个文本框,按钮,时钟,在程序运行的时候出现了这么一句话:"Couldn't get a process handle!",调试时发现错在Timer中,但就是找不出原因,请哪位大哥帮我?或者发个修改器制作的范例,谢谢!我这里只是初步的找窗口,读进程,还需要大哥的指点```

类模块的代码
Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal IpClassName As String, ByVal IpWindowName As String) As Long
Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, IpdwProcessId As Long) As Long
Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Long, ByVal IpBaseAddress As Any, ByVal IpBuffer As Any, ByVal nSize As Long, IpNumberOfBytesWritten As Long) As Long
Declare Function ReadProcessMemory Lib "kernel32" (ByVal hProcess As Long, ByVal IpBaseAddress As Any, ByVal IpBuffer As Any, ByVal nSize As Long, IpNumberOfBytesWritten As Long) As Long
Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long

工程代码
Private Sub Command1_Click()
  Dim hwnd As Long
  Dim pid As Long
  Dim pHandle As Long
  hwnd = FindWindow(vbNullString, "Resident Evil 3")
  If (hwnd = 0) Then
    MsgBox "Window not found!"
  Exit Sub
  End If
  GetWindowThreadProcessId hwnd, pid
  pHandle = OpenProcess(PROCESS_ALL_ACCESS, False, pid)
  If (pHandle = 0) Then
    MsgBox "Couldn't get a process handle!"
  Exit Sub
  End If
  WriteProcessMemory pHandle, &HA62285, "Beans", 5, 0&
  CloseHandle hProcess
End Sub

Private Sub Timer1_Timer()
  Dim hwnd As Long
  Dim pid As Long
  Dim pHandle As Long
  Dim str As String * 20
  hwnd = FindWindow(vbNullString, "Resident Evil 3")
  If (hwnd = 0) Then Exit Sub
  GetWindowThreadProcessId hwnd, pid
  pHandle = OpenProcess(PROCESS_ALL_ACCESS, False, pid)
  If (pHandle = 0) Then Exit Sub
  ReadProcessMemory pHandle, &HA62285, str, 30, 0&
  Text1 = str
  CloseHandle hProcess
End Sub
[em24]

0

主题

7

帖子

7

积分

新手上路

Rank: 1

积分
7
发表于 2006-3-1 21:05:00 | 显示全部楼层

Re:会VB制作修改器的大侠看看好么

朋友你的基本没有什么问题,主要是你没有获得进程,我有源代码,
QQ:11273854
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2026-1-23 19:55

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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