Form5.frm
上传用户:albinfu
上传日期:2021-08-24
资源大小:71k
文件大小:10k
- VERSION 5.00
- Begin VB.Form Form5
- BackColor = &H80000018&
- BorderStyle = 1 'Fixed Single
- Caption = "热键设定"
- ClientHeight = 1710
- ClientLeft = 45
- ClientTop = 435
- ClientWidth = 6585
- Icon = "Form5.frx":0000
- LinkTopic = "Form5"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 1710
- ScaleWidth = 6585
- StartUpPosition = 3 '窗口缺省
- Begin VB.CheckBox Check1
- BackColor = &H80000018&
- Caption = "SHIFT"
- BeginProperty Font
- Name = "Arial"
- Size = 11.25
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 375
- Index = 2
- Left = 2900
- TabIndex = 10
- Top = 480
- Width = 975
- End
- Begin VB.CheckBox Check1
- BackColor = &H80000018&
- Caption = "ALT"
- BeginProperty Font
- Name = "Arial"
- Size = 11.25
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 375
- Index = 1
- Left = 1620
- TabIndex = 9
- Top = 480
- Width = 735
- End
- Begin VB.CheckBox Check1
- BackColor = &H80000018&
- Caption = "CTRL"
- BeginProperty Font
- Name = "Arial"
- Size = 11.25
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 375
- Index = 0
- Left = 120
- TabIndex = 8
- Top = 480
- Width = 975
- End
- Begin VB.CommandButton Command1
- Caption = "取消"
- BeginProperty Font
- Name = "Arial"
- Size = 9.75
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 495
- Index = 1
- Left = 5400
- TabIndex = 7
- Top = 1150
- Width = 1095
- End
- Begin VB.CommandButton Command1
- Caption = "修改"
- BeginProperty Font
- Name = "Arial"
- Size = 9.75
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 615
- Index = 0
- Left = 5400
- TabIndex = 6
- Top = 480
- Width = 1095
- End
- Begin VB.TextBox Text1
- Alignment = 2 'Center
- BeginProperty Font
- Name = "Arial"
- Size = 9.75
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 375
- Index = 3
- Left = 4560
- TabIndex = 4
- Top = 480
- Width = 495
- End
- Begin VB.Label Label3
- BackColor = &H80000018&
- Caption = "其中,Ctrl 或 Alt 或 Shift 至少输入其中的一个(在键值前打勾即可),最后一格输入A~Z 范围内的任一个字母。符合要求后单击‘修改’按钮。"
- BeginProperty Font
- Name = "Arial"
- Size = 9.75
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 735
- Left = 120
- TabIndex = 5
- Top = 930
- Width = 4935
- End
- Begin VB.Label Label2
- Alignment = 2 'Center
- BackColor = &H80000018&
- Caption = "+"
- BeginProperty Font
- Name = "Arial"
- Size = 14.25
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 375
- Index = 2
- Left = 3960
- TabIndex = 3
- Top = 480
- Width = 375
- End
- Begin VB.Label Label2
- Alignment = 2 'Center
- BackColor = &H80000018&
- Caption = "+"
- BeginProperty Font
- Name = "Arial"
- Size = 14.25
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 375
- Index = 1
- Left = 2400
- TabIndex = 2
- Top = 480
- Width = 375
- End
- Begin VB.Label Label2
- Alignment = 2 'Center
- BackColor = &H80000018&
- Caption = "+"
- BeginProperty Font
- Name = "Arial"
- Size = 14.25
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 375
- Index = 0
- Left = 1080
- TabIndex = 1
- Top = 480
- Width = 375
- End
- Begin VB.Label Label1
- BackColor = &H80000018&
- Caption = "请输入唤醒窗口全局快捷键 格式:(Ctrl + Alt + Shift + A~Z )"
- BeginProperty Font
- Name = "Arial"
- Size = 9.75
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 255
- Left = 120
- TabIndex = 0
- Top = 120
- Width = 6255
- End
- End
- Attribute VB_Name = "Form5"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Private Sub Check1_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
- Dim i As Integer, Ch As Boolean
- Ch = False
- For i = 0 To 2
- If Check1(i).Value = 1 Then Ch = True: Exit For
- Next i
- If Ch = False Then Command1(0).Enabled = False
- If Text1(3).Text = "" Then
- Ch = False
- Command1(0).Enabled = False
- Exit Sub
- End If
- If Ch = True And Asc(Text1(3).Text) < 91 And Asc(Text1(3).Text) > 64 Then
- Command1(0).Enabled = True
- End If
- End Sub
- Private Sub Command1_Click(Index As Integer)
- Select Case Index
- Case 1
- Me.Visible = False
- Case 0
- Dim ToKey As Long, MyKey As Long, i As Integer, YouKey(0 To 2) As Long
- YouKey(0) = MOD_CONTROL
- YouKey(1) = MOD_ALT
- YouKey(2) = MOD_SHIFT
- For i = 0 To 2
- If Check1(i).Value = 1 Then
- MyKey = MyKey + YouKey(i)
- End If
- Next i
- Dim ret As Long '====设置全局快捷键=============一设置了热键则结束时终止进程====== =
- ret = SetWindowLong(Me.hwnd, GWL_WNDPROC, AddressOf WndProc)
- idHotkey = 1
- Modifiers = MyKey
- uVirtkey = Asc(Text1(3).Text)
- ret = RegisterHotKey(Me.hwnd, idHotkey, Modifiers, uVirtkey)
- SaveSetting "key", "FAST", 0, MyKey
- SaveSetting "key", "FAST", 1, Asc(Text1(3).Text)
- 'preWindProc = GetWindowLong(Me.hwnd, GWL_WNDPROC) '==这一段不能加入===
- Me.Visible = False
- End Select
- End Sub
- Private Sub Form_Load()
- Me.Left = Screen.Width / 3
- Me.Top = Screen.Height / 3 + Me.Height
- Command1(0).Enabled = False
- End Sub
- 'x = GetSetting("key", "FAST", 0, "")
- 'y = GetSetting("key", "FAST", 1, "")
- Private Sub Text1_Change(Index As Integer) '====48-57====
- If Text1(Index) = "" Then
- Command1(0).Enabled = False
- Me.Caption = "热键设定 提示:键值不能为空"
- Exit Sub
- End If
- Text1(Index).Text = UCase(Text1(Index).Text)
- Text1(3).SelLength = Len(Text1(3).Text)
- If Asc(Text1(3).Text) > 90 Or Asc(Text1(3).Text) < 65 Then
- Text1(3).SelStart = 0
- Text1(3).SelLength = Len(Text1(3).Text)
- Me.Caption = "热键设定 提示:请输入一个 A - Z 范围的字母"
- DoEvents
- Command1(0).Enabled = False
- Exit Sub
- Else
- Me.Caption = "热键设定 "
- Text1(3).SelLength = Len(Text1(3).Text)
- End If
- If Len(Text1(3)) > 1 Then
- Me.Caption = "热键设定 提示:输入不能超过2位"
- Command1(0).Enabled = False
- Exit Sub
- End If
- Dim i As Integer, Ch As Boolean
- Ch = False
- For i = 0 To 2
- If Check1(i).Value = 1 Then Ch = True: Exit For
- Next i
- If Ch = False Then Command1(0).Enabled = False
- If Ch = True And Asc(Text1(3).Text) < 91 And Asc(Text1(3).Text) > 64 Then
- Command1(0).Enabled = True
- End If
- End Sub