Public Declare Function SetWindowLong Lib "user32.dll" Alias "SetWindowLongA" _
(ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Public Const GWL_WNDPROC = (-4)
Public Declare Function CallWindowProc Lib "user32.dll" Alias "CallWindowProcA" _
(ByVal lpPrevWndFunc As Long, ByVal hWnd As Long, ByVal msg As Long, _
ByVal wParam As Long, ByVal lParam As Long) As Long
Public hOldWndProc As Long
Public Const WM_HOTKEY = &H312
Public Declare Function RegisterHotKey Lib "user32.dll" _
(ByVal hWnd As Long, ByVal id As Long, ByVal fsModifiers As Long, ByVal vk As Long) As Long
Public Declare Function UnregisterHotKey Lib "user32.dll" _
(ByVal hWnd As Long, ByVal id As Long) As Long
Public Function WndProc(ByVal hWnd As Long, ByVal msg As Long, _
ByVal wParam As Long, ByVal lParam As Long) As Long
If msg = WM_HOTKEY Then
If wParam = &H100 Then
MsgBox "[F1]が押された"
End If
End If
WndProc = CallWindowProc(hOldWndProc, hWnd, msg, wParam, lParam)
End Function |