AutoIT GUICtrlSetState/GUICtrlGetState的设置状态与获取状态不同 [英] AutoIT GUICtrlSetState/GUICtrlGetState set state is different from get state

查看:228
本文介绍了AutoIT GUICtrlSetState/GUICtrlGetState的设置状态与获取状态不同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要我的代码帮助.

 GUICtrlSetState($input_ID_betonarna,$gui_ENABLE)
 ConsoleWrite(GUICtrlGetState($input_ID_betonarna)&" "& $gui_ENABLE)

输出为: 80 64

Output is: 80 64

预期输出为: 64 64

Expected output is: 64 64

我知道输出是状态的总和,但是我没有任何带有GUIConstantsEx值的表.

I know that output is sum of states but i do not have any table with GUIConstantsEx values.

推荐答案

查看您的AutoIt安装.在包含"子文件夹中,您应该找到文件 GUIConstantsEx.au3 ,其中定义了这些常量:

Look into your AutoIt installation. In the "include" subfolder you should find the file GUIConstantsEx.au3 where those constants are defined:

Global Const $GUI_SHOW = 16
Global Const $GUI_HIDE = 32
Global Const $GUI_ENABLE = 64
Global Const $GUI_DISABLE = 128

获得80值的原因是因为这是一个位掩码,并且控件实际上具有2种状态:已启用并显示,所以:

The reason you get the value of 80 is because this is a bit mask and the control actually has 2 states: It is enabled and shown, so:

$GUI_SHOW = 16
$GUI_ENABLE = 64

总和是80,这就是您在输出中得到的.

The sum is 80 and that's what you got in your output.

编辑:如果要针对特定​​状态测试控件的状态,例如切换按钮的状态,则可以使用BitAND运算符:

If you want to test the state of a control for a specific state, for example to toggle the state of a button, then you can use the BitAND operator:

If BitAND(GUICtrlGetState($cmdOk), $GUI_DISABLE) = $GUI_DISABLE Then
    GUICtrlSetState($cmdOk, $GUI_ENABLE)
EndIf

这篇关于AutoIT GUICtrlSetState/GUICtrlGetState的设置状态与获取状态不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆