Autoit检查单复选框的选中状态
Autoit
#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #include
#include
#include
Opt("MustDeclareVars", 1)
Global $iMemo
_Main()
Func _Main()
Local $rdo, $rdo2, $chk
GUICreate("Buttons", 400, 400)
$iMemo = GUICtrlCreateEdit("", 119, 10, 276, 374, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
$rdo = GUICtrlCreateRadio("Radio1", 10, 10, 90, 50)
$rdo2 = GUICtrlCreateRadio("Radio2", 10, 60, 90, 50)
_GUICtrlButton_SetCheck($rdo2)
_GUICtrlButton_SetFocus($rdo2) ; set focus, shows this doesn't affect _GUICtrlButton_GetCheck
$chk = GUICtrlCreateCheckbox("Check1", 10, 120, 90, 50, BitOR($BS_AUTO3STATE, $BS_NOTIFY))
_GUICtrlButton_SetCheck($chk, $BST_INDETERMINATE)
GUISetState()
MemoWrite("$rdo checked status.: " & @CRLF & @TAB & _ExplainCheckState(_GUICtrlButton_GetCheck($rdo)) & @CRLF)
MemoWrite("$rdo2 checked status: " & @CRLF & @TAB & _ExplainCheckState(_GUICtrlButton_GetCheck($rdo2)) & @CRLF)
MemoWrite("$chk checked status.: " & @CRLF & @TAB &
_ExplainCheckState(_GUICtrlButton_GetCheck($chk)) & @CRLF)
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd
Exit
EndFunc ;==>_Main
; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1) EndFunc ;==>MemoWrite
Func _ExplainCheckState($iState)
Switch $iState
Case $BST_CHECKED
Return "Button is checked."
Case $BST_INDETERMINATE
Return "Button is grayed, indicating an indeterminate state
(applies only if the button has the $BS_3STATE or $BS_AUTO3STATE style)."
Case $BST_UNCHECKED
Return "Button is cleared"
EndSwitch
EndFunc ;==>_ExplainCheckState
_GUICtrlButton_GetCheck
得到单选按钮或者复选框选中状态
#Include
_GUICtrlButton_GetCheck($hWnd)
$hWnd Handle to the control
Success: The return value from a button created with the $BS_AUTOCHECKBOX,
$BS_AUTORADIOBUTTON,
$BS_AUTO3STATE, $BS_CHECKBOX, $BS_RADIOBUTTON, or $BS_3STATE
style can be one of the following:
$BST_CHECKED - Button is checked.
$BST_INDETERMINATE - Button is grayed, indicating an
indeterminate state (applies only if the button has the
$BS_3STATE or $BS_AUTO3STATE style).
$BST_UNCHECKED Button is cleared Failure: 0
If the button has a style other than those listed, the return value is
zero.