Hello shimanov,
works great. But I found a strange behaviour. When the GUI is created and the mouse cursor is not within the new window at startup, the mouse cursor is an hourglass (IDC_WAIT?) when entering the GUI.
Another thing I recognized. Sometimes the mousecursor changes back to the arrow cursor when moving over the URL text control. But that's no problem.
The limitation (mouse jumps) is negligible I think.
I made some slight modifications to your script for my personal use.
(comments, indentation, ...)
Code:
Gui, Add, Picture,, %A_WinDir%\winnt.bmp
Gui, Add, Text,, www.test.com
Gui, Add, Text, cBlue gMyLink vURL_MyLink, www.google.com
Gui, Font, norm
Gui, Add, Text, cGreen gMyMail, someone@place.com
Gui, Font, norm
Gui, Add, Text, cRed, www.hello.com
Gui, Show,, URL Workaround
; Retrieve scripts PID
Process, Exist
pid_this := ErrorLevel
; Retrieve unique ID number (HWND/handle)
WinGet, hw_gui, ID, ahk_class AutoHotkeyGUI ahk_pid %pid_this%
; Call "HandleMessage" when script receives WM_SETCURSOR message
WM_SETCURSOR = 0x20
OnMessage( WM_SETCURSOR, "HandleMessage" )
; Call "HandleMessage" when script receives WM_MOUSEMOVE message
WM_MOUSEMOVE = 0x200
OnMessage( WM_MOUSEMOVE, "HandleMessage" )
Return
GuiClose:
ExitApp
;###############################################################################
;######## End of GUI ###########################################################
;###############################################################################
;###############################################################################
;######## GUI glabels ##########################################################
;###############################################################################
MyLink:
MsgBox, MyLink
return
MyMail:
MsgBox, MyMail
return
;###############################################################################
;######## End Of GUI glabels ###################################################
;###############################################################################
;###############################################################################
;######## Hotkeys ###############################################################
;###############################################################################
F10::
CoordMode, Mouse, Screen
MouseMove, 5, 5, 0
Return
F11::
Reload
Return
F12::
ExitApp
;###############################################################################
;######## End of Hotkeys ######################################################
;###############################################################################
;###############################################################################
;######## Functions ############################################################
;###############################################################################
HandleMessage( p_w, p_l, p_m, p_hw )
{
global WM_SETCURSOR, WM_MOUSEMOVE
static URL_hover, h_old_cursor
If ( p_m = WM_SETCURSOR )
{
Return, true
}
Else If (p_m = WM_MOUSEMOVE)
{
; Mouse cursor hovers URL text control
If (A_GuiControl = "URL_MyLink")
{
If URL_hover =
{
; Underline URL Text control during hover
Gui, Font, cBlue underline
GuiControl, Font, URL_MyLink
h_cursor_hand := DllCall("LoadCursor", "uint", 0, "uint", 32649)
h_old_cursor := DllCall("SetCursor", "uint", h_cursor_hand)
URL_hover := true
}
}
; Mouse cursor doesn't hover URL text control
Else
{
If URL_hover
{
Gui, Font, norm cBlue
GuiControl, Font, URL_MyLink
DllCall("SetCursor", "uint", h_old_cursor)
URL_hover =
}
}
}
}
;###############################################################################
;######## End Of Functions #####################################################
;###############################################################################