form1.frm
来自「最基本的按键代码适合初学者,可以用于简单的游戏应用」· FRM 代码 · 共 74 行
FRM
74 行
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 4350
ClientLeft = 60
ClientTop = 435
ClientWidth = 4080
LinkTopic = "Form1"
ScaleHeight = 4350
ScaleWidth = 4080
StartUpPosition = 3 '窗口缺省
Begin VB.Timer Timer1
Interval = 500
Left = 3480
Top = 120
End
Begin VB.Label Label3
Caption = "Label3"
Height = 375
Left = 120
TabIndex = 2
Top = 840
Width = 1455
End
Begin VB.Label Label2
Caption = "Label2"
Height = 255
Left = 120
TabIndex = 1
Top = 480
Width = 1575
End
Begin VB.Label Label1
Caption = "启动提示!"
Height = 255
Left = 120
TabIndex = 0
Top = 120
Width = 1455
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
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 Sub Timer1_Timer()
Dim cc As Long
Dim cc2 As Long
Dim cc3 As Long
cc = FindWindow(vbNullString, "寻仙")
If cc = 0 Then
Label1.Caption = "寻仙游戏启动成功"
Else
labe1.captiion = "启动失败"
End If
GetWindowThreadProcessId cc, cc2
If cc2 = 0 Then
Label2.Caption = "返回成功"
Else
Label2.Caption = "返回失败"
End If
cc3 = OpenProcess(process_all_access, False, cc2)
End Sub
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?