AutoIT installation state GUICtrlSetState / GUICtrlGetState is different from the receive state

I need help with my code.

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

Output: 80 64

Expected Result: 64 64

I know that output is a sum of states, but I don't have a table with GUIConstantsEx values.

+2
source share
1 answer

Look at your AutoIt installation. In the “include” subfolder you should find the file GUIConstantsEx.au3, where these constants are defined:

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

The reason you get the value 80 is because it is a bit mask, and the control actually has 2 states: it is turned on and shown, therefore:

$GUI_SHOW = 16
$GUI_ENABLE = 64

The amount is 80 and what you got in your output.

: , , , BitAND:

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

All Articles