What's this all about? Well I want the basic hover effect: when my mouse cursor hovers over a link, I want that link to turn blue and display an underline. When I move the cursor away from the link, I want the link returned to black without an underline.

How?

#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%
#SingleInstance Force

; ******************************************************************************
; CREATE GUI

Gui, Color, FFFFFF
Gui, +OwnDialogs +SysMenu +Caption +0x800000
Gui, Add, Text, gOpenDocumentation, Open the documentation
Gui, Show, w600 h700, %ThisProgramName%
WinSet, AlwaysOnTop, On, %ThisProgramName%
OnMessage(0x200, "WM_MOUSEMOVE")
Return

OpenDocumentation:
   MsgBox, Oh no you clicked on me!
Return

; ******************************************************************************
; MOUSE MOVEMENT (Tooltips)

WM_MOUSEMOVE()
{
    static CurrControl, PrevControl
    CurrControl := A_GuiControl

	If (CurrControl<>"" OR PrevControl<>"") {
		If (CurrControl <> PrevControl)
		{
			Gui, Font, cBlue underline
			GuiControl, Font, %CurrControl%
			PrevControl:=CurrControl
		} else {
			Gui, Font, cBlack norm
			GuiControl, Font, %CurrControl%
			PrevControl:=""
		}
	}
}

; ******************************************************************************

	GuiClose:
	close:
		Gui, Destroy
		ExitApp

Now this results in a tiny GUI that displays the link in black and works (somewhat). If you copy the above code into an AutoHotkey file, you'll find this is remarkably temperamental. If the user is too quick with their mouseovers and mouseouts, then the GUI will sometimes leave the link as blue despite the mouse cursor not being anywhere near it.

Proper HTML mouseovers:
When I have a more stable solution. I would however recommend cwebpage.dll at as a minimum for internal HTML pages for use in an AutoHotkey GUI.

Add comment


Send