#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Include <WinAPI.au3>

Global $Window

Func _xhck()
$xhtitle = GUICreate("星号查看", 281, 109, -1, -1, -1, -1, $window)
GUISetBkColor(0xEFF0F2)
$xianshixh = GUICtrlCreateInput("", 16, 16, 249, 21)
$Ckzd = GUICtrlCreateCheckbox("窗口置顶", 16, 48, 73, 17)
GUICtrlSetState($Ckzd,$GUI_CHECKED)
WinSetOnTop($xhtitle,"",1)
$Cktm = GUICtrlCreateCheckbox("窗口透明", 104, 48, 73, 17)
$Starting = GUICtrlCreateButton("开始", 112, 72, 75, 25)
$fanhuiform = GUICtrlCreateButton("停止", 192, 72, 75, 25)
GUISetState(@SW_SHOW)

While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $GUI_EVENT_CLOSE
			GUIDelete($xhtitle)
			ExitLoop
		Case $Starting
			While 1
				$H = WinGetHandle("")
				$CH = ControlGetHandle($H,"","")
				_WinAPI_PostMessage($CH, $EM_SETPASSWORDCHAR,0,0)
				$js = ControlGetFocus("","")
				$HS = ControlGetText("","",$js)
				GUICtrlSetData($xianshixh,$HS)
				$nMsg = GUIGetMsg()
				Switch $nMsg
					Case $fanhuiform
						GUICtrlSetData($xianshixh,"")
						ExitLoop
				EndSwitch
			WEnd
		Case $Ckzd
			While 1
				If GUICtrlRead($Ckzd) = $GUI_CHECKED Then
					WinSetOnTop($xhtitle,"",1)
				ElseIf GUICtrlRead($Ckzd) = $GUI_UNCHECKED Then
					WinSetOnTop($xhtitle,"",0)
				EndIf
				ExitLoop
			WEnd
		Case $Cktm
			While 1
				If GUICtrlRead($Cktm) = $GUI_CHECKED Then
					WinSetTrans($xhtitle,"",170)
				ElseIf GUICtrlRead($Cktm) = $GUI_UNCHECKED Then
					WinSetTrans($xhtitle,"",255)
				EndIf
				 ExitLoop
			 WEnd
	EndSwitch
WEnd
EndFunc