In the control window below:
Dim CtlHwnd As Long
Private Sub UserControl_Show ()
If UserControl. Ambient. UserMode Then 'runtime
CtlHwnd=UserControl. The HWND
PreWndProc=SetWindowLong (CtlHwnd GWL_WNDPROC, AddressOf WindowProc)
End the If
End Sub
Private Sub UserControl_Terminate ()
Call SetWindowLong (CtlHwnd GWL_WNDPROC, preWndProc)
End Sub
In the control module
Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal HWND As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Public Declare Function CallWindowProc Lib "user32" 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 Const GWL_WNDPROC=(4)
Public preWndProc As Long
The Public Function WindowProc (ByVal HWND As Long, ByVal iMsg As Long, ByVal wParam As Long, ByVal lParam) As Long As Long
The Static kk As Long
Kk=kk + 1
If kk & gt; 10 Then kk=0
The Debug. Print kk
WindowProc=CallWindowProc (preWndProc HWND, iMsg, wParam, lParam)
End the Function
The control on the normal FORM, other basic can intercept keyboard messages, is the direction key no response,