📄 pro_8.frm
字号:
VERSION 5.00
Begin VB.Form Form1
BorderStyle = 1 'Fixed Single
Caption = "Program8"
ClientHeight = 4485
ClientLeft = 45
ClientTop = 330
ClientWidth = 6900
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4485
ScaleWidth = 6900
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton Command1
Caption = "清 除"
Height = 315
Left = 3180
TabIndex = 1
Top = 3720
Width = 1155
End
Begin VB.Timer Timer1
Enabled = 0 'False
Interval = 200
Left = 180
Top = 3960
End
Begin VB.TextBox Text1
Height = 3435
Left = 120
TabIndex = 0
Top = 60
Width = 6675
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 GetForegroundWindow& Lib "user32" ()
Private Declare Function GetWindowText& Lib "user32" Alias "GetWindowTextA" _
(ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long)
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, _
ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Private Declare Function MapVirtualKey& Lib "user32" Alias "MapVirtualKeyA" _
(ByVal wCode As Long, ByVal wMapType As Long)
Private Const VK_CONTROL& = &H11 'ctrl键的虚拟键值
Private Const KEYEVENTF_KEYUP% = &H2
Private Const VK_V& = &H56 'V键的ascii码值(虚拟键值)
Private Sub Command1_Click()
Text1.Text = ""
End Sub
Private Sub Text1_Change()
Timer1.Enabled = True
Clipboard.Clear
Clipboard.SetText Form1.Text1.Text
End Sub
Private Sub Timer1_Timer()
Dim dl1&, dl2&
Dim Canp As String * 255
dl1& = GetForegroundWindow&() '获取当前活动窗口的句柄
dl2& = GetWindowText&(dl1&, Canp$, 255) '获取窗口的标题
If Left(Canp$, 14) = "Microsoft Word" Then
MyCapture 1
Timer1.Enabled = False
End If
End Sub
Public Sub MyCapture(ByVal mode%) '生成一次模拟击键Ctrl+v
Dim altscan%
Dim dl&
Dim snapparam%
altscan% = MapVirtualKey(VK_CONTROL, 0)
keybd_event VK_CONTROL, altscan, 0, 0
keybd_event VK_V, 0, 0, 0
keybd_event VK_CONTROL, altscan, KEYEVENTF_KEYUP, 0
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -