Public Function CreateKotKeyCtrl(pctParent As PictureBox) As Long
Dim hwnd As Long
Dim hFont As Long
hwnd = CreateWindowEx( _
0, _
HOTKEY_CLASS, _
"", _
WS_CHILD Or WS_VISIBLE, _
0, 0, _
pctParent.Width / Screen.TwipsPerPixelX, _
pctParent.Height / Screen.TwipsPerPixelY, _
pctParent.hwnd, _
0, _
0, _
0 _
)
Call SendMessage(hwnd, HKM_SETRULES, _
HKCOMB_NONE Or HKCOMB_S, _
MAKELPARAM(HOTKEYF_ALT, 0))
hFont = SendMessage(pctParent.hwnd, WM_GETFONT, 0, 0)
Call SendMessage(hwnd, WM_SETFONT, hFont, -1)
CreateKotKeyCtrl = hwnd
End Function
'自前のウィンドウプロシージャ
Public Function MainFormWindowProc(ByVal hwnd As Long, ByVal uMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
On Error GoTo ErrorHandle
Select Case uMsg
Case WM_HOTKEY
If Right$(Hex$(wParam), 4) = Hex$(nHotKeyID) Then
Call MsgBox("HotKey Push!")
End If
End Select
'デフォルトのウィンドウプロシージャを呼び出す
MainFormWindowProc = CallWindowProc(lngDefaultProc, hwnd, uMsg, wParam, lParam)
Exit Function
ErrorHandle:
Debug.Print Err.Number & " : " & Err.Description
Resume Next
End Function
|