#include <GUIConstantsEx.au3>
$hGUI = GUICreate("_GUICtrlHyperlink_Handler", 300, 200)
$nAutoIt_Hyperlink = _GUICtrlHyperlink_Create("Русское сообщество AutoIt", 80, 80, 140, 15, 0x0000FF, 'Посетить www.autoit-script.ru')
$nCreatoRLab_Hyperlink = _GUICtrlHyperlink_Create("Лаборатория CreatoR'а", 90, 110, 120, 15, 0x0000FF, 'Отобразить информацию о веб-сайте...')
GUISetState(@SW_SHOW, $hGUI)
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
Case $nAutoIt_Hyperlink
_GUICtrlHyperlink_Handler($hGUI, $nAutoIt_Hyperlink, "http://autoit-script.ru", -1, 0x551A8B)
Case $nCreatoRLab_Hyperlink
_GUICtrlHyperlink_Handler($hGUI, $nCreatoRLab_Hyperlink, '_CreatoRLab_ShowInfo("' & $nCreatoRLab_Hyperlink & '")', 1, 0x551A8B)
EndSwitch
WEnd
Func _CreatoRLab_ShowInfo($nCtrlID)
MsgBox(64, 'Info', 'Hyperlink Clicked:' & @CRLF & GUICtrlRead($nCtrlID), 0, $hGUI)
EndFunc
Func _GUICtrlHyperlink_Create($sText, $iLeft, $iTop, $iWidth = -1, $iHeight = -1, $iColor = 0x0000FF, $sToolTip = '', $iStyle = -1, $iExStyle = -1)
Local $ID = GUICtrlCreateLabel($sText, $iLeft, $iTop, $iWidth, $iHeight, $iStyle, $iExStyle)
If $ID Then
GUICtrlSetFont($ID, -1, -1, 4)
GUICtrlSetColor($ID, $iColor)
GUICtrlSetCursor($ID, 0)
GUICtrlSetTip($ID, $sToolTip)
EndIf
Return $ID
EndFunc
Func _GUICtrlHyperlink_Handler($hWnd, $iCtrlID, $sActionURL, $iAction = -1, $iVisitedColor = 0x551A8B)
Local $aCurInfo = GUIGetCursorInfo($hWnd)
If Not IsArray($aCurInfo) Then Return 0
While IsArray($aCurInfo) And $aCurInfo[2] = 1
$aCurInfo = GUIGetCursorInfo($hWnd)
If $aCurInfo[4] <> $iCtrlID Then
GUISetCursor(7, 1, $hWnd)
Else
GUISetCursor(2, 0, $hWnd)
EndIf
Sleep(10)
WEnd
GUISetCursor(2, 0, $hWnd)
If IsArray($aCurInfo) And $aCurInfo[4] = $iCtrlID Then
If $iAction = 1 Then
Execute($sActionURL)
Else
ShellExecute($sActionURL)
EndIf
If @error = 0 And $iVisitedColor Then
GUICtrlSetColor($iCtrlID, $iVisitedColor)
EndIf
EndIf
EndFunc