📄 pro_5_01.frm
字号:
VERSION 5.00
Begin VB.Form Form1
BackColor = &H00C0C0C0&
BorderStyle = 1 'Fixed Single
Caption = "Play27"
ClientHeight = 5100
ClientLeft = 45
ClientTop = 330
ClientWidth = 5385
Icon = "pro_5_01.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 5100
ScaleWidth = 5385
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton Command4
Caption = "设置快捷键"
Height = 315
Left = 960
TabIndex = 6
Top = 480
Width = 1455
End
Begin VB.Timer Timer2
Interval = 100
Left = 480
Top = 120
End
Begin VB.CommandButton Command3
Caption = "清除图片"
Height = 315
Left = 960
TabIndex = 5
Top = 1920
Width = 1455
End
Begin VB.PictureBox Picture1
BackColor = &H00000000&
Height = 2175
Left = 2520
ScaleHeight = 2115
ScaleWidth = 2655
TabIndex = 4
Top = 180
Width = 2715
End
Begin VB.CommandButton Command1
Caption = "装入图片"
Height = 315
Left = 960
TabIndex = 3
Top = 840
Width = 1455
End
Begin VB.ListBox List1
Height = 2220
Left = 120
TabIndex = 1
Top = 2760
Width = 3435
End
Begin VB.Timer Timer1
Interval = 100
Left = 60
Top = 120
End
Begin VB.CommandButton Command2
Caption = "关 闭"
Height = 315
Left = 3900
TabIndex = 0
Top = 4500
Width = 1155
End
Begin VB.Image Image1
Height = 2085
Left = 2520
Picture = "pro_5_01.frx":030A
Top = 2400
Visible = 0 'False
Width = 2700
End
Begin VB.Label Label2
BackColor = &H00C0C0C0&
Caption = "当前按键列表∶"
Height = 315
Left = 120
TabIndex = 2
Top = 2520
Width = 2655
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' 《VB前线》http://vbbattlefront.163.net
'************************************************************
'* VB 系列功能演示程序 *
'* *
'* 如果您发现此程序有任何不妥之处或存在需要改进的地方, *
'* 望告诉我本人,本人将非常感激您,并一定回信致谢! *
'* *
'* by 池星泽(Xing) my Email:vbxing@990.net *
'************************************************************
'*程序编号∶027
'*功 能∶演示了如何检测当前按键状态
'*日 期∶3/16/1999
'************************************************************
Option Explicit
Private Sub Command1_Click()
Picture1.Picture = Image1.Picture
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Command3_Click()
Picture1.Picture = LoadPicture("")
End Sub
Private Sub Command4_Click()
Dim dl As Long
Form2.Show
End Sub
Private Sub Form_Load()
Dim i As Integer
Move (Screen.Width - Form1.Width) \ 2, (Screen.Height - Form1.Height) \ 2
End Sub
Private Sub Form_Unload(Cancel As Integer)
End
End Sub
Private Sub Timer1_Timer()
Dim i As Integer
Dim Key(0 To 255) As Byte
Dim dl As Long
Dim KeyCode As Long
Dim KeyName As String * 256
List1.Clear
dl& = GetKeyboardState(Key(0)) '获取当前按键状态
For i = 0 To 254
If Key(i) And &H80 Then
KeyCode& = MapVirtualKey(i, 0)
dl& = GetKeyNameText(KeyCode * &H10000, KeyName, 255)
List1.AddItem "[ " & Left(KeyName, dl&) & " ]键,虚拟键码为(十进制)∶" & CStr(i) & Chr(13) & Chr(10)
End If
Next
End Sub
Private Sub Timer2_Timer()
Dim Key As Integer
Dim NowKey As Long
NowKey = 0
If HotKey = 0 Then Exit Sub
Key% = GetKeyState(VK_SHIFT)
If Key And &H4000 Then NowKey = NowKey Or HOTKEYF_SHIFT
Key% = GetKeyState(VK_CONTROL)
If Key And &H4000 Then NowKey = NowKey Or HOTKEYF_CONTROL
Key% = GetKeyState(VK_MENU)
If Key And &H4000 Then NowKey = NowKey Or HOTKEYF_ALT
Key% = GetKeyState(HotKey_Cild)
If Key And &H4000 And HotKey = NowKey Then
Command1_Click
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -