游戏开发论坛

 找回密码
 立即注册
搜索
查看: 2703|回复: 4

关于VB读取内存数据取不到进程

[复制链接]

5

主题

17

帖子

17

积分

新手上路

Rank: 1

积分
17
发表于 2006-4-24 17:16:00 | 显示全部楼层 |阅读模式
模块:
Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId 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 lpBaseAddress As Any, ByVal lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long
Declare Function ReadProcessMemory Lib "kernel32" (ByVal hProcess As Long, ByVal lpBaseAddress As Any, ByVal lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long
Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Public Const PROCESS_ALL_ACCESS = &H1F0FFF


Private Sub Command1_Click()
Dim hwnd As Long
Dim pid As Long
Dim pHandle As Long
Dim str As String
hwnd = FindWindow(vbNullString, "QQ幻想1.21")
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 “错误”                                                 'pHandle 一直等0 是怎么回事呢???
Exit Sub
End If
' 在内存地址中写入名字
'WriteProcessMemory pHandle, &H40B181, "Beans", 5, 0&
ReadProcessMemory pHandle, &H4584C58, str, 20, 0&
Text1.Text = str
CloseHandle hProcess
End Sub

26

主题

537

帖子

537

积分

高级会员

Rank: 4

积分
537
发表于 2006-4-25 14:43:00 | 显示全部楼层

Re:关于VB读取内存数据取不到进程

还真不了解 OpenProcess这个API的用法

1

主题

86

帖子

86

积分

注册会员

Rank: 2

积分
86
发表于 2006-4-26 08:42:00 | 显示全部楼层

Re:关于VB读取内存数据取不到进程

VB能读写内存,那做游戏修改工具很容易呀。

19

主题

40

帖子

52

积分

注册会员

Rank: 2

积分
52
发表于 2006-4-28 16:45:00 | 显示全部楼层

Re:关于VB读取内存数据取不到进程

看看我那个扫雷作弊器的帖子吧,绝对管用~~~呵呵~~

19

主题

40

帖子

52

积分

注册会员

Rank: 2

积分
52
发表于 2006-4-28 16:46:00 | 显示全部楼层

Re:关于VB读取内存数据取不到进程

http://bbs.gameres.com/showthread.asp?threadid=3883
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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