shift.frm

来自「捕获键盘操作的记录」· FRM 代码 · 共 32 行

FRM
32
字号
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "判断Shift键"
   ClientHeight    =   1830
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   3405
   LinkTopic       =   "Form1"
   ScaleHeight     =   1830
   ScaleWidth      =   3405
   StartUpPosition =   3  '窗口缺省
   Begin VB.Timer Timer1 
      Interval        =   1
      Left            =   1200
      Top             =   1200
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Declare Function GetAsyncKeyState Lib "user32" (ByVal VKEY As Long) As Integer

Private Sub Timer1_Timer()
Dim longShift As Long
longShift = GetAsyncKeyState(vbKeyShift)
If longShift <> 0 Then MsgBox "Shift键被按下"
End Sub

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?