这是我以前在网上看到的,请你参考#include <GuiConstants.au3>
Global $MARk_1 = 0
Global $DEFAULTINPUTDATA_1 = "Click and type something here..."
Global $NONEAACTIVECOLOR = 0x989898
$GUI = GUICreate("Check Inputs Demo", 280, 150)
$Input_1 = GUICtrlCreateInput($DEFAULTINPUTDATA_1, 15, 20, 250, 20)
GUICtrlSetColor(-1, $NONEAACTIVECOLOR)
$ExitButton = GUICtrlCreateButton("Exit", 110, 125, 60, 20)
GUICtrlSetState(-1, $GUI_DEFBUTTON)
GUISetState()
ControlFocus($Gui, "", $ExitButton)
While 1
_CheckInput($GUI, $Input_1, "Click and type something here...", $DEFAULTINPUTDATA_1, $MARK_1)
Switch GUIGetMsg()
Case $ExitButton, -3
Exit
EndSwitch
WEnd
Func _CheckInput($hWnd, $ID, $InputDefText, ByRef $DefaultInputData, ByRef $Mark)
If $Mark = 0 And _IsFocused($hWnd, $ID) And $DefaultInputData = $InputDefText Then
$Mark = 1
GUICtrlSetData($ID, "")
GUICtrlSetColor($ID, 0x000000)
$DefaultInputData = ""
EndIf
EndFunc
Func _IsFocused($hWnd, $nCID)
Return ControlGetHandle($hWnd, '', $nCID) = ControlGetHandle($hWnd, '', ControlGetFocus($hWnd))
EndFunc
|