- Код: Выделить всё
Private Sub UserControl_Initialize()
SubClasser.AddSubclassHook hWnd, Me, DoNotTransfer
End Sub
Private Function ISubclass_Callback(ByVal hWnd As Long, uMsg As Long, wParam As Long, lParam As Long, ByVal PrevProc As Long) As Long
Dim typTME As tagTRACKMOUSEEVENT
Static blnHot As Boolean
Select Case uMsg
Case WM_MOUSELEAVE
Debug.Print "WM_MOUSELEAVE"
blnHot = False
Redraw BS_NORMAL
Case WM_MOUSEHOVER
Debug.Print "WM_MOUSEHOVER"
blnHot = True
Redraw BS_HOT
Case WM_MOUSEMOVE
Debug.Print "WM_MOUSEMOVE"
If blnHot Then
typTME.cbSize = LenB(typTME)
typTME.hwndTrack = hWnd
typTME.dwFlags = TME_HOVER Or TME_LEAVE
typTME.dwHoverTime = 1
TrackMouseEvent typTME
End If
End Select
If PrevProc Then ISubclass_Callback = SubClasser.CallWindowProc(PrevProc, hWnd, uMsg, wParam, lParam)
End Function
WM_MOUSELEAVE и WM_MOUSEHOVER не отслеживаются