Search the Community
Showing results for tags 'BitOR'.
-
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.
-
I am taking some idea from here: '?do=embed' frameborder='0' data-embedContent>> But what I am looking to accomplish is simple, I want to have an input box with a hidden input box below it. I will also have a defined list of items. When the text box has any value in it that does not directly equal an item in the pre defined list, the edit box should show. and populate suggested items based on whats being typed which I will do that part later, should be easy. I am stuck on a simple portion which should be easy and i'm not sure why I am having trouble with it. The way thr code below should work is, as long as there is a value in the Input box, the edit box will appear, if there is no value in the input box, the edit box should be hidden. here is what I have so far: #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 615, 438, 192, 124) $Input1 = GUICtrlCreateInput("", 64, 72, 313, 21) $Edit1 = GUICtrlCreateEdit("", 64, 96, 313, 177) GUISetState(@SW_SHOW) GUICtrlSetState($Edit1, $GUI_HIDE) While 1 $words = GUICtrlRead($Input1) If $words NOT = "" then GUICtrlSetState($Edit1, $GUI_SHOW) else GUICtrlSetState($Edit1, $GUI_HIDE) endif $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd func flopdrop() If BitAnd($Edit1,2) AND $words = "" Then GUICtrlSetState($Edit1, $GUI_HIDE) Else GUICtrlSetState($Edit1, $GUI_SHOW) EndIf endfunc the problem with this is a nasty flicker when you move the mouse or do anything else. I will get rid of the scroll bars too, but thats once I solve this flicker issue. I know its happening because I have the check being performed within the While statement, but I can't think of any other way to do it.. I even tried using a timer to only check once every few seconds, but that didn't seem to work either: If $words NOT = "" AND (@SEC = 00 OR 10 OR 20 OR 30 OR 40 OR 50) AND (@MSEC < 20)) Then ; Blah blah blah endIf Does anyone have any thoughts or has anyone been able to do this? Thanks in advance!!
-
Hi, I am referring to code being presented in this thread () that discusses about enabling windows to lock to relative positions when moving around. I am requesting help in these areas: 1. Is it possible for the secondary window to not have both its relative X and Y positions set to the primary window's coordinates, when minimized? Example code: Func showBottomForm($userID, $hWindow) ; Bottom form $g_hBottomForm = GUICreate("Bottom Form", $CONST_NORMAL_WIDTH, $CONST_NORMAL_HEIGHT, -1, WinGetPos($hWindow)[1] + WinGetPos($hWindow)[3], -1, $WS_EX_TOOLWINDOW) $hButton_Form = GUICtrlCreateButton("Bottom Form Button", 80, 10, 120, 30) GUISetState() EndFunc ;==>showBottomForm What this means is that if I moved the secondary window around before minimizing the primary window and then re-maximize the primary window again, the secondary window's position could be set correctly. But if the secondary window is not moved and then the primary window is minimized/re-maximized immediately, the secondary window's position gets locked to the X/Y coordinates of the primary window. 2. Is it possible for the secondary window to be shown together with the primary window when the primary window is re-maximized in the presence of other application windows? What happens now is that the secondary window (based on above code) could not be seen if there are other windows shown. But if every window is minimized (except my AutoIt app), then I can see the secondary window. What changes are needed? I tried the following: GUICreate("Bottom Form", $CONST_NORMAL_WIDTH, $CONST_NORMAL_HEIGHT, -1, WinGetPos($hWindow)[1] + WinGetPos($hWindow)[3], -1, BitOR($WS_EX_TOOLWINDOW, $WS_EX_CLIENTEDGE)) This didn't really cause much change, so I am kinda stumped now. All help appreciated.
- 4 replies
-
- $WS_EX_TOOLWINDOW
- BitOR
- (and 4 more)
-
Hello community If i have: BitOR($SS_CENTER, $SS_CENTERIMAGE) And i want to use it like a default parameter in a fuction, i think i need to set the "numeric" value like: Func Test1($param, $param2, $style = 0x00000000) ; 0x00000000 = i need to set here BitOR($SS_CENTER, $SS_CENTERIMAGE) How to convert the BitOR($variable1, $variable2) to his numeric value? Thanks