快捷键呼出窗体
‘经测试很好用,可以把hide的窗体也可以显示出来
‘窗体中
Option Explicit
Private Sub Command2_Click()
Me.Hide
End Sub
Private Sub Form_Load()
Dim ret As Long
‘记录原来的window程序地址
preWinProc = GetWindowLong(Me.hWnd, GWL_WNDPROC)
‘用自定义程序代替原来的window程序
ret = SetWindowLong(Me.hWnd, GWL_WNDPROC, AddressOf wndproc)
idHotKey = 1 ‘in the range &h0000 through &hBFFF
Modifiers = MOD_ALT ‘辅助键为Alt
uVirtKey1 = vbKeyQ ‘注册的热键为Alt+Q
‘注册热键
ret = RegisterHotKey(Me.hWnd, idHotKey, Modifiers, uVirtKey1)
If ret = 0 Then
MsgBox “注册热键失败,请使用其它热键!”, vbCritical, “错误”
[...]