标题:【求助】用vb6做了一个获取游戏中数据(魔兽争霸)的软件,但是不起作用,各位 ...
只看楼主
zyf779403234
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2011-10-30
结帖率:0
 问题点数:0 回复次数:1 
【求助】用vb6做了一个获取游戏中数据(魔兽争霸)的软件,但是不起作用,各位来看看是怎么回事啊
程序代码:
Private 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
Dim dizhi As Long
Const STANDARD_RIGHTS_REQUIRED = &HF0000
Const SPECIFIC_RIGHTS_ALL = &HFFFF
Const STANDARD_RIGHTS_ALL = &H1F0000
Const PROCESS_ALL_ACCESS = &HFFF
Const PROCESS_VM_OPERATION = &H8&
Const PROCESS_VM_READ = &H10&
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId 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 Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Private Declare Function GetCurrentProcess Lib "kernel32" () As Long

Private Sub Command2_Click()
End
End Sub

Private Sub Form_Load()
dizhi = &H9430190
End Sub

   Private Function ncnr(lpADDress As Long) As Integer
   Dim hwnd As Long      
   Dim pid As Long      
   Dim pHandle As Long  
   hwnd = FindWindow(vbNullString, "Warcraft III")
   GetWindowThreadProcessId hwnd, pid
   pHandle = OpenProcess(PROCESS_ALL_ACCESS, False, pid)
   ReadProcessMemory pHandle, lpADDress, ByVal VarPtr(ncnr), 4, 0&
   CloseHandle hProcess
End Function

Private Sub Timer1_Timer()
On Error Resume Next
Dim s, objWMIService, colProcessList, objProcess
Dim mFind As Boolean
s = "war3.exe"
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name='" & s & "'")
For Each objProcess In colProcessList
mFind = True
Next
If mFind Then
Label1 = "游戏已经加载。 [War3.exe]"
Else
Label1 = "进程没有被找到。 [请运行War3.exe]"
End If
End Sub

Private Sub Timer2_Timer()
Label5 = ncnr(dizhi)
End Sub

请问我哪里有问题啊?
搜索更多相关主题的帖子: 魔兽争霸 软件 游戏 
2013-08-26 22:32
zyf779403234
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2011-10-30
得分:0 
没人吗??

努力学习vb中...
2013-08-27 19:53



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-419692-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.962865 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved