Jump to content
Sign in to follow this  

Mouse Tracking ToolTip w/ Marquee

Recommended Posts


I'm experimenting with ways to notify the user of a software installs status and came up with a mouse tracking tool tip with a scrolling Marquee. It's a bit too obtrusive for constant display but some someone here might find a use for it.

#Region MouseMove_Event
    #include <String.au3>
    Global Const $WH_MOUSE_LL                   = 14
    Global Const $MOUSE_MOVE_EVENT              = 512

    Dim $hKey_Proc
    Dim $hM_Module
    Dim $hM_Hook
    Func _EnableMouseCapture()
        $hKey_Proc  = DllCallbackRegister("_Mouse_Move_Handler", "int", "int;ptr;ptr")
        $hM_Module  = DllCall("kernel32.dll", "hwnd", "GetModuleHandle", "ptr", 0)
        $hM_Hook    = DllCall("user32.dll", "hwnd", "SetWindowsHookEx", "int", $WH_MOUSE_LL, "ptr", DllCallbackGetPtr($hKey_Proc), "hwnd", $hM_Module[0], "dword", 0)   
    Func _DisableMouseCapture()
    Func _Mouse_Move_Handler($nCode, $wParam, $lParam)
        If $MOUSE_MOVE_EVENT = BitAND($wParam, 0xFFFF) Then
            ;ConsoleWrite('Mouse Pad' & @CRLF)
            ToolTip($ToolTip, Default, Default, 'HRAO Software Update')
        Return 0

    Func OnAutoItExit()
        If IsArray($hM_Hook) And $hM_Hook[0] > 0 Then
            DllCall("user32.dll", "int", "UnhookWindowsHookEx", "hwnd", $hM_Hook[0])
            $hM_Hook[0] = 0
        If IsPtr($hKey_Proc) Then
            $hKey_Proc = 0

Const $Title    = "But why is the rum gone?  "
Const $MarqueeLen = 32

Dim $Caption    = '                "I am dishonest. And a dishonest man you can always trust to be dishonest. Honestly, it''s the honest ones you ought to watch out for, because you can never predict when they''re about to do something incredibly stupid." ~Captain Jack Sparrow'
Dim $ToolTip    = '  ' & _Marquee($Caption, $MarqueeLen)


While True
    $ToolTip =  '  ' & _Marquee($Caption, $MarqueeLen)
    ToolTip($ToolTip, Default, Default, $Title, 2);, 4)

Func _Marquee(ByRef $StringToScroll, $Length)
    If StringLen($StringToScroll) <= $Length Then Return $StringToScroll
    If Not IsDeclared('MarqueePosition') Then
        Global $MarqueePosition = 1
    ElseIf $MarqueePosition > StringLen($MarqueePosition) Then
        $MarqueePosition = 1
        $MarqueePosition += 1
    $StringToScroll = Stringmid($StringToScroll, 2) & StringLeft($StringToScroll, 1)
    Return stringleft($StringToScroll, $Length)

--- TTFN

Share this post

Link to post
Share on other sites

Very Nice! Could be handy for something like an alert for a group of people alerting them of some msg to where they must see it and acknowledge a tray button to get rid of it.. Thanks!

edit: type-O

Edited by gesller

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.