文件名称:sethotkey
- 所属分类:
- Windows编程
- 资源属性:
- [Windows] [Visual C] [Basic/ASP] [源码]
- 上传时间:
- 2014-05-15
- 文件大小:
- 2kb
- 下载次数:
- 0次
- 提 供 者:
- jpu****
- 相关连接:
- 无
- 下载说明:
- 别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容均来自于网络,请自行研究使用
VB设置快捷键的例子,自定义打开某程序的快捷键,这只是一个示例,演示原理和具体的代码实现:
Dim bCancel As Boolean 用于判断是否退出程序
Public Sub RegFastKey() 注册快捷键
Dim ret As Long
bCancel = False
ret = RegisterHotKey(hwnd, &HBFFF&, MOD_CONTROL, vbKeyF)
ProcessMessages
End Sub
Public Sub UnRegFastKey()
bCancel = True
UnregisterHotKey hwnd, &HBFFF&
End Sub
Private Sub ProcessMessages() 监听快捷键消息
Dim Message As Msg
Do While Not bCancel
If PeekMessage(Message, hwnd, WM_HOTKEY, WM_HOTKEY, &H1) Then
MsgBox "快捷键"
End If
DoEvents
Loop
End Sub-VB to set an example of shortcuts, custom shortcuts to open a program, this is just an example that demonstrates the principles and specific code:
Dim bCancel As Boolean used to determine whether to exit the program
Public Sub RegFastKey () registration shortcuts
Dim ret As Long
bCancel = False
ret = RegisterHotKey (hwnd, & HBFFF &, MOD_CONTROL, vbKeyF)
ProcessMessages
End Sub
Public Sub UnRegFastKey ()
bCancel = True
UnregisterHotKey hwnd, & HBFFF &
End Sub
Private Sub ProcessMessages () listen shortcuts message
Dim Message As Msg
Do While Not bCancel
If PeekMessage (Message, hwnd, WM_HOTKEY, WM_HOTKEY, & H1) Then
MsgBox "shortcut"
End If
DoEvents
Loop
End Sub
Dim bCancel As Boolean 用于判断是否退出程序
Public Sub RegFastKey() 注册快捷键
Dim ret As Long
bCancel = False
ret = RegisterHotKey(hwnd, &HBFFF&, MOD_CONTROL, vbKeyF)
ProcessMessages
End Sub
Public Sub UnRegFastKey()
bCancel = True
UnregisterHotKey hwnd, &HBFFF&
End Sub
Private Sub ProcessMessages() 监听快捷键消息
Dim Message As Msg
Do While Not bCancel
If PeekMessage(Message, hwnd, WM_HOTKEY, WM_HOTKEY, &H1) Then
MsgBox "快捷键"
End If
DoEvents
Loop
End Sub-VB to set an example of shortcuts, custom shortcuts to open a program, this is just an example that demonstrates the principles and specific code:
Dim bCancel As Boolean used to determine whether to exit the program
Public Sub RegFastKey () registration shortcuts
Dim ret As Long
bCancel = False
ret = RegisterHotKey (hwnd, & HBFFF &, MOD_CONTROL, vbKeyF)
ProcessMessages
End Sub
Public Sub UnRegFastKey ()
bCancel = True
UnregisterHotKey hwnd, & HBFFF &
End Sub
Private Sub ProcessMessages () listen shortcuts message
Dim Message As Msg
Do While Not bCancel
If PeekMessage (Message, hwnd, WM_HOTKEY, WM_HOTKEY, & H1) Then
MsgBox "shortcut"
End If
DoEvents
Loop
End Sub
(系统自动生成,下载前可以参看下载内容)
下载文件列表
快捷键\Form1.frm
......\Module1.bas
......\MSSCCPRJ.SCC
......\工程1.vbp
......\工程1.vbw
快捷键