回复 8# user3000
大侠,能不能帮我看看,是怎么回事,我改去改来都没有改得好。Global $EM_SETPASSWORDCHAR = 0xCC
Global $a,$b,$c
Local $text_wenben= "请输入qq号码"
Global $Mark_1 = 0
Global $NONEAACTIVECOLOR = 0x989898
$a = GUICreate("Test", 350, 98, 192, 124)
$c = GUICtrlCreateInput("", 88, 62, 201, 21)
$b = GUICtrlCreateInput($text_wenben, 88, 32, 201, 21)
GUICtrlSetColor(-1, $NONEAACTIVECOLOR)
GUISetState()
While 1
_CheckInput($a, $b, "请输入qq号码", $text_wenben, $Mark_1)
If GUIGetMsg() = -3 Then ExitLoop
WEnd
Func _CheckInput($hWnd, $ID, $InputDefText, ByRef $text_wenben, ByRef $Mark)
If $Mark = 0 And _IsFocused($hWnd, $ID) And $text_wenben = $InputDefText Then
$Mark = 1
GUICtrlSetData($ID, "")
GUICtrlSetColor($ID, 0x000000)
$text_wenben = ""
$d = GUICtrlRead($b)
;If $d <> "请输入qq号码" Then GUICtrlSendMsg($b, $EM_SETPASSWORDCHAR, 42, 0)
; 星号"*" 的ASCII字符序号为 42
ElseIf $Mark = 1 And Not _IsFocused($hWnd, $ID) And $text_wenben = "" And GUICtrlRead($ID) = "" Then
$Mark = 0
$text_wenben = $InputDefText
GUICtrlSetData($ID, $text_wenben)
GUICtrlSetColor($ID, $NONEAACTIVECOLOR)
EndIf
EndFunc
Func _IsFocused($hWnd, $nCID)
Return ControlGetHandle($hWnd, '', $nCID) = ControlGetHandle($hWnd, '', ControlGetFocus($hWnd))
EndFunc
|