jeudi 26 novembre 2020

VB script - If clause with hex const [duplicate]

I'm analyse a VB script with a if clause I don't understand. It works like this:

Const current_status_01 = &H1480781
Const current_status_02 = &H204a2780
Const status_1 = &h00002000
Const status_2 = &h00100000

If (current_status_01 And status_1) Or (current_status_01 And status_2) Then
    MsgBox "True", VBOKOnly, "If 1"
Else
    MsgBox "False", VBOKOnly, "If 1"
End if

If (current_status_02 And status_1) Or (current_status_02 And status_2) Then
    MsgBox "True", VBOKOnly, "If 2"
Else
    MsgBox "False", VBOKOnly, "If 2"
End if

Could someone please explain me why the first if condition is false and the second one is true? It would be nice if someone could write this example in Python too for my understanding.

Thank you!

Aucun commentaire:

Enregistrer un commentaire