AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

can anyone explain to me just one line of code? (bitwise &am

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Guest






PostPosted: Wed May 14, 2008 4:39 am    Post subject: can anyone explain to me just one line of code? (bitwise &am Reply with quote

hello
i saw this code in help
i know it works. i just would like to UNDERSTAND it

Code:
WinGet, Style, Style, My Window Title
if (Style & 0x8000000)  ;<--------- This line
  ... the window is disabled, so perform appropriate action.

for example.
that Style variable will be 0x14CF0000 if i tried with notepad
but how was that code could know if 0x8000000 is in Style variable or not?
0x8000000 in 0x14CF0000?
i know it's hexadecimal and this bitwise operator does something that i don't understand
can anyone explain to me how it works theoretically?
Thanks in advance!
Back to top
tonne



Joined: 06 Jun 2006
Posts: 1143
Location: Denmark

PostPosted: Wed May 14, 2008 8:37 am    Post subject: Reply with quote

Bitwise operation
_________________
there's a dog barking close within the range of my ear
sounds like he wants to escape the chain
he would probably bite me to death if he could
but the chain lets me spit in his face

- Kashmir
Back to top
View user's profile Send private message
Guest






PostPosted: Wed May 14, 2008 9:12 am    Post subject: Reply with quote

ok thank for answer tonne
i think i understand it a bit now
in autohotkey, every integers are decimal right?
can i operate in binary directly?
something like Msgbox % 1111 ^ 0101 ?
Back to top
[VxE]



Joined: 07 Oct 2006
Posts: 883

PostPosted: Wed May 14, 2008 9:34 am    Post subject: Reply with quote

Anonymous wrote:
can i operate in binary directly?
something like Msgbox % 1111 ^ 0101 ?

yes, but not with that syntax. There are functions on the forums which convert decimal to binary (hex), or you can just use hex. If you know what you're doing, you don't need to work in hex to use the bitwise operators, since an integer is an integer is an integer.

Code:
msgbox % 0xF ^ 5
SetFormat, Integer, Hex
msgbox % 0xF ^ 5

_________________
My Home Thread
More Common Answers: 1. It's in the FAQ 2. Ternary ( ? : ) guide 3. Post code with [code][/code] tags
Back to top
View user's profile Send private message
Guest






PostPosted: Wed May 14, 2008 9:44 am    Post subject: Reply with quote

[VxE] wrote:
an integer is an integer is an integer.

thanks for answer VxE
i know what you mean
you mean numeric system doesn't matter cause it's just how it looks right?
i just curious if my input can be distinguished as binary directly
because i'm not familiar with numeric system conversion
i'm so confused

why isn't there SetFormat, Integer, Binary Sad
i want to operate like 1111 ^ 0101 not 15 ^ 5 or 0xF ^ 5
because it's so confusing to me
Back to top
Guest






PostPosted: Wed May 14, 2008 9:56 am    Post subject: Reply with quote

Got it! Very Happy
Back to top
Guest






PostPosted: Wed May 14, 2008 10:26 am    Post subject: Reply with quote

Anonymous wrote:
Got it! Very Happy

it wasn't me (original poster) Confused
Back to top
Guest






PostPosted: Wed May 14, 2008 11:04 am    Post subject: Reply with quote

Nor me!!
Back to top
Guest






PostPosted: Wed May 14, 2008 11:07 am    Post subject: Reply with quote

It was me, Guest. So what? Very Happy
Back to top
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group