#include once "window9.bi"

Function HyperLinkGadget(ByVal gadget As Long, _
						ByVal x As Long, ByVal y As Long, _
						ByVal w As Long ,ByVal h As Long,_
						ByRef s As USTRING) As HWND Export
	Static FONT As integer
	Static flag As bool
	Static Cursor As HCURSOR
	If flag=0 Then
		flag = 1
		Font = LoadFont("Arial",10,,,,1)
		Cursor = LoadCursor(0,IDC_HAND)
	End If
	#ifdef UNICODE
		Var hWin = CreateWindowEx( 0, "static", *s, WS_VISIBLE Or WS_CHILD Or SS_NOTIFY, x,y,w,h, win9GetCurrent(), Cast(HMENU,CInt(gadget)), 0, 0)
	#else	
		Var hWin = CreateWindowEx( 0, "static", s, WS_VISIBLE Or WS_CHILD Or SS_NOTIFY, x,y,w,h, win9GetCurrent(), Cast(HMENU,CInt(gadget)), 0, 0)
	#EndIf
	SetClassLongPtr(hWin,GCLP_HCURSOR,cast(LONG_PTR,Cursor))
	win9AddNewGadget(gadget, hWin)
	win9AddColor(hWin, 15790320,&hFF0000)
	SendMessage(hWin, WM_SETFONT, Cast(WPARAM,FONT),0)
	Return hWin
End Function
