Created
April 1, 2021 17:17
-
-
Save Generhr/d546a3a7ac1f5e45573d7e2916aa2317 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for i, v in [0x0200, 0x02A3, 0x02A1, 0x0201, 0x0202, 0x0203, 0x0204, 0x0205, 0x0206, 0x0207, 0x0208, 0x0209, 0x020A, 0x020E] { | |
OnMessage(v, "MsgHandler") | |
} | |
Exit | |
TrackMouseEvent(hWNDTrack, dwFlags := 0x00000002, dwHoverTime := 400) { ;: https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-trackmouseevent | |
Static cbSize := 8 + (A_PtrSize*2) | |
VarSetCapacity(sEventTrack, cbSize, 0) | |
, NumPut(cbSize, sEventTrack, 0, "UInt"), NumPut(dwFlags, sEventTrack, 4, "UInt"), NumPut(hWNDTrack, sEventTrack, 8, "Ptr"), NumPut(dwHoverTime, sEventTrack, 8 + A_Ptrsize, "UInt") ;: https://docs.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-trackmouseevent | |
return, (DllCall("TrackMouseEvent", "UInt", &sEventTrack, "UInt")) ;* Non-zero on success. | |
} | |
MsgHandler(wParam, lParam, msg, hWND) { | |
; ToolTip, % (x := lParam & 0xFFFF) ", " (y := lParam >> 16) | |
if (!A_Gui) { ;* This is here to ignore `ToolTip` windows. | |
return, (0) | |
} | |
switch (msg) { | |
case 0x0200: ;? 0x0200 = WM_MOUSEMOVE | |
Static Tracking | |
if (!Tracking) { | |
ToolTip, % "WM_MOUSEMOVE" | |
Tracking := TrackMouseEvent(hWND, 0x00000003) ;? 0x00000003 = TME_LEAVE + TME_HOVER | |
} | |
;* The mouse left the client area of the window specified in a prior call to TrackMouseEvent. All tracking requested by TrackMouseEvent is canceled when this message is generated. The application must call TrackMouseEvent when the mouse reenters its window if it requires further tracking of mouse hover behavior. | |
case 0x02A3: ;? 0x02A3 = WM_MOUSELEAVE | |
ToolTip, % "WM_MOUSELEAVE" | |
Tracking := !TrackMouseEvent(hWND, 0x80000000) ;? 0x80000000 = TME_CANCEL | |
;* The mouse hovered over the client area of the window for the period of time specified in a prior call to TrackMouseEvent. Hover tracking stops when this message is generated. The application must call TrackMouseEvent again if it requires further tracking of mouse hover behavior. | |
case 0x02A1: ;? 0x02A1 = WM_MOUSEHOVER | |
Static Perpetual := 0 | |
ToolTip, % "WM_MOUSEHOVER" | |
if (Perpetual) { | |
Tracking := TrackMouseEvent(hWND, 0x00000001) ;? 0x00000001 = TME_HOVER | |
} | |
case 0x0201: ;? 0x0201 = WM_LBUTTONDOWN | |
ToolTip, % "WM_LBUTTONDOWN" | |
case 0x0202: ;? 0x0202 = WM_LBUTTONUP | |
ToolTip, % "WM_LBUTTONUP" | |
case 0x0203: ;? 0x0203 = WM_LBUTTONDBLCLK | |
ToolTip, % "WM_LBUTTONDBLCLK" | |
case 0x0204: ;? 0x0204 = WM_RBUTTONDOWN | |
ToolTip, % "WM_RBUTTONDOWN" | |
case 0x0205: ;? 0x0205 = WM_RBUTTONUP | |
ToolTip, % "WM_RBUTTONUP" | |
case 0x0206: ;? 0x0206 = WM_RBUTTONDBLCLK | |
ToolTip, % "WM_RBUTTONDBLCLK" | |
case 0x0207: ;? 0x0207 = WM_MBUTTONDOWN | |
ToolTip, % "WM_MBUTTONDOWN" | |
case 0x0208: ;? 0x0208 = WM_MBUTTONUP | |
ToolTip, % "WM_MBUTTONUP" | |
case 0x0209: ;? 0x0209 = WM_MBUTTONDBLCLK | |
ToolTip, % "WM_MBUTTONDBLCLK" | |
case 0x020A: ;? 0x020A = WM_MOUSEWHEEL (Vertical) | |
ToolTip, % "WM_MOUSEWHEEL" | |
case 0x020E: ;? 0x020E = WM_MOUSEWHEEL (Horizontal) | |
ToolTip, % "WM_MOUSEWHEEL" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment