vb注册系统级快捷级
谁能帮我注释一下。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 '是不是&h0000 through &hBFFF 范围内的任意数呀
Modifiers = MOD_ALT ' + MOD_SHIFT
uVirtKey = vbKeyZ
'注释: 注册热键
ret = RegisterHotKey(Me.hwnd, idHotKey, Modifiers, uVirtKey)color=Red] '我要注册另一个快捷键,是再写一句吗,还要不要记录原程序
模块代码:
Public Function wndproc(ByVal hwnd As Long, ByVal Msg As Long, _ ‘过程名必须用wndproc吗,还是自定义
ByVal wParam As Long, ByVal lParam As Long) As Long
If Msg = WM_HOTKEY Then ‘这句什么意思
If wParam = idHotKey Then
Dim lp As taLong, i2 As t2Int ‘lp和i2是做什么用的
lp.ll = lParam
LSet i2 = lp
If (i2.lWord = Modifiers) And i2.hword = uVirtKey Then ‘(i2.lWord和i2.hword什么意思
‘程序要处理的事件
End If
End If
End If
'将之送往原来的Window Procedure
wndproc = CallWindowProc(preWinProc, hwnd, Msg, wParam, lParam)
End Function
[[it] 本帖最后由 zfc123 于 2008-3-19 14:43 编辑 [/it]]