232showtime

bitAND magic numbers help

4 posts in this topic

good day,

Please I need a little help ive been trying to find where I got this magic number and I remember it was for Minimize, but I really dont remember where I got this. Last thing I remember i was reading the help file and saw this minize magic numbers, but I cant find it anymore, I dnt wnt to use this magic number anymore OMG! please help...

here it is.

Local $hAaSf = "C:\Main.xlsx" ;Main excel
Local $iStateAsf = WinGetState($hAaSf)
BitAND($iStateAsf, 16)

 


ill get to that... i still need to learn and understand a lot of codes graduated.gif

Correct answer, learn to walk before you take on that marathon.

Share this post


Link to post
Share on other sites



From the WinGetState helpfile and its example script:

Quote

$WIN_STATE_MINIMIZED (16) = Window is minimized

(...)

If BitAND($iState, 16) Then
    MsgBox($MB_SYSTEMMODAL, "", "Notepad is minimized and the state returned by WinGetState was - " & $iState)

 

According to the helpfile, you can also use $WIN_STATE_MINIMIZED, but I can't find that anywhere so either I'm missing something or the helpfile is wrong there. So I guess you're forced to just take that magic number from the help file or define your own constants.

1 person likes this

Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites

This is a bug and has been fixed in the latest revision of AutoIt: https://www.autoitscript.com/trac/autoit/ticket/3116

You would have to wait for another release if you want to use $WIN_STATE_* constants ;).

1 person likes this

AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Spoiler

My contributions to the AutoIt Community

Some messages & Apologizes:

If I hurt you, Please accept my apologies, I never (regardless of the situation) mean to hurt anybody!!!

Also, I am very busy with my project so I will appear in the last row of the online list, if you want to contact me: Email@TheDcoder.xyz

Or you can have a nice chat with me in freenode, I use the same nick on freenode too!

3fHNZJ.gif

PLEASE JOIN ##AutoIt AND HELP THE IRC AUTOIT COMMUNITY!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Similar Content

    • j0kky
      By j0kky
      Hi guys,
      Bitwise operations in Autoit is possible only till 32 bit integers, but sometimes WinAPI requires to process 64 bit vectors... so?
      So you can use this little UDF to handle properly those integers!
      Func _BitAND64($iValue1, $iValue2) If Not ((VarGetType($iValue1) = "Int64") Or (VarGetType($iValue2) = "Int64")) Then Return BitAND($iValue1, $iValue2) $iValue1 = __DecToBin64($iValue1) $iValue2 = __DecToBin64($iValue2) Local $aValueANDed[64], $i For $i = 0 To 63 $aValueANDed[$i] = ($iValue1[$i] And $iValue2[$i]) ? 1 : 0 Next Return __BinToDec64($aValueANDed) EndFunc ;==>_BitAND64 Func _BitOR64($iValue1, $iValue2) If Not ((VarGetType($iValue1) = "Int64") Or (VarGetType($iValue2) = "Int64")) Then Return BitOR($iValue1, $iValue2) $iValue1 = __DecToBin64($iValue1) $iValue2 = __DecToBin64($iValue2) Local $aValueORed[64], $i For $i = 0 To 63 $aValueORed[$i] = ($iValue1[$i] Or $iValue2[$i]) ? 1 : 0 Next Return __BinToDec64($aValueORed) EndFunc ;==>_BitOR64 Func _BitXOR64($iValue1, $iValue2) If Not ((VarGetType($iValue1) = "Int64") Or (VarGetType($iValue2) = "Int64")) Then Return BitXOR($iValue1, $iValue2) $iValue1 = __DecToBin64($iValue1) $iValue2 = __DecToBin64($iValue2) Local $aValueXORed[64], $i For $i = 0 To 63 $aValueXORed[$i] = (($iValue1[$i] And (Not $iValue2[$i])) Or ((Not $iValue1[$i]) And $iValue2)) ? 1 : 0 Next Return __BinToDec64($aValueXORed) EndFunc ;==>_BitXOR64 Func _BitNOT64($iValue) If Not (VarGetType($iValue) = "Int64") Then Return BitNOT($iValue) $iValue = __DecToBin64($iValue) For $i = 0 To 63 $iValue[$i] = Not $iValue[$i] Next Return __BinToDec64($iValue) EndFunc ;==>_BitNOT64 Func __DecToBin64($iDec) Local $tDec = DllStructCreate("int64 num"), $aBin[64], $bBit, $i $tDec.num = $iDec For $i = 0 To 63 $bBit = (Mod($tDec.num, 2) ? 1 : 0) $aBin[63 - $i] = $bBit $tDec.num = Floor($tDec.num / 2) Next Return $aBin EndFunc ;==>__DecToBin64 Func __BinToDec64($aBin) Local $tDec = DllStructCreate("int64 num"), $i If $aBin[0] Then $tDec.num += 0x8000000000000000 ;2^63 = 9223372036854775808, but for Autoit the world ends at 9223372036854775807 (2^63 - 1) For $i = 1 To 63 If $aBin[$i] Then $tDec.num += 2 ^ (63 - $i) Next Return $tDec.num EndFunc ;==>__BinToDec64 If you are working with unsigned 64 bit integers and these functions return a negative value, don't worry, bitwise operations come out well, but Autoit manages all numbers as signed integers.
    • Ruigerock
      By Ruigerock
      Goodmorning people,
      I've been busy with a usefull script for work but one part is not working as I thought it would.
      I took the known _IsEnabled function, change 3 words to have it check an disabled checkbox status
      The code below is not the actual script but it demonstrates the error.
      If you select "Check all but disabled" it will select all 3 checkboxes which is not my intention, ehh help?
      #include <MsgBoxConstants.au3> #include <GuiConstants.au3> #include <GuiConstantsEx.au3> Local $box[03] GuiCreate("Test", 300, 300, -1, -1) $box[00] = GUICtrlCreateCheckbox("Unchecked", 20, 40, 240, 20) $box[01] = GUICtrlCreateCheckbox("Disabled", 20, 60, 240, 20) $box[02] = GUICtrlCreateCheckbox("Checked", 20, 80, 240, 20) GUICtrlSetState($box[00], $GUI_UNCHECKED) GUICtrlSetState($box[01], $GUI_DISABLE) GUICtrlSetState($box[02], $GUI_CHECKED) $Button_Ok = GUICtrlCreateButton("Check all but Disabled", 20 , 110, 180, 45) $Button_KO = GUICtrlCreateButton("UnCheck all", 20 , 155, 180, 45) GuiSetState() Func _IsDisable($control) Return BitAND(GUICtrlRead($control), $GUI_DISABLE) = $GUI_DISABLE EndFunc While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $Button_Ok For $i = 0 to 2 If _IsDisable($box[$i]) Then GUICtrlSetState($box[$i], $GUI_UNCHECKED) Else GUICtrlSetState($box[$i], $GUI_CHECKED) EndIf Next Case $msg = $Button_KO For $i = 0 to 2 GUICtrlSetState($box[$i], $GUI_UNCHECKED) Next EndSelect WEnd