1,488
社区成员




Private Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Long, ByVal lpBaseAddress As Any, lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long
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 ReadProcessMemory Lib "kernel32" (ByVal hProcess As Long, lpBaseAddress As Any, lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Private Const PROCESS_ALL_ACCESS = &H1F0FFF
Dim hwnd1 As Long
Dim pid As Long
Dim pHandle As Long
Private Function ncnr(lpADDress As Long) As Integer
hwnd1 = FindWindow(vbNullString, "01")
GetWindowThreadProcessId hwnd1, pid
pHandle = OpenProcess(PROCESS_ALL_ACCESS, False, pid)
ReadProcessMemory pHandle, lpADDress, ByVal VarPtr(ncnr), 6, 0&
CloseHandle pHandle
End Function
Private Sub Timer1_Timer()
hwnd1 = FindWindow(vbNullString, "01")
If hwnd1 = 0 Then
Label1.Caption = "程序未运行"
Text1.Text=""
Else
Label1.Caption = "程序已运行"
Text1.Text = ncnr(&H401E46)
End If
End Sub