When using logical operators, such as Or (or) And in a common manner, such as:
[vba]
Sub exa11()
Dim lNumOne As Long, lNumTwo As Long
lNumOne = CLng(InputBox("Enter Number", vbNullString))
lNumTwo = CLng(InputBox("Enter Number", vbNullString))
If lNumOne > 5 Or lNumTwo > 10 Then
MsgBox "Passed"
Else
MsgBox "Failed"
End If
End Sub
[/vba]
...if a number exceeding 5 is entered into the first input, OR, a number exceeding 10 is placed in the second, the overall test is passed, as only one of the conditions must be met for a True to be returned. This I get.
However, when I have used snippets of examples (in my case, usually API related), I have used expressions such as:
[vba]
Public Function TitleBar_Hide(UF As Object, lUFHandle As Long)
Dim lWindow As Long
lUFHandle = FindWindowA(vbNullString, UF.Caption)
lWindow = GetWindowLong(lUFHandle, GWL_STYLE)
lWindow = lWindow And (Not WS_CAPTION)
Call SetWindowLong(lUFHandle, GWL_STYLE, lWindow)
Call DrawMenuBar(lUFHandle)
End Function
[/vba]
or...
[vba]
lngRet = InsertMenu(hMenuPopMisc, 1&, MF_POPUP Or MF_BYPOSITION Or MF_ENABLED, hMenuPop, "Viewable Months")
[/vba]
...where argument 3 has 3 different constants listed.
I could not quickly find an example (so hope I don't botch), but it seems to me what I've seen a number of times is similar to:
[vba]
lWhatever = lSomeVariable Or A_Constant
[/vba]
My question is particularly to what is the Or doing, but I would appreciate if what is happening with 'lWindow And (Not WS_CAPTION)' is touched on.
If this would require an overly lengthy explanation, keywords to google by or suggestions as to what to read would be great.
As always and of course, thank you so much,
Mark