DLL uses combination args???

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm attempting to use the API SetWindowPos. The last argument is Word:
wFlags define as a long. It takes multiple flags separated in C by the or
symbol | .

How can I simulate this in VB?

Any help is appreciated.

J.
 
If you use '+', you get null propagation

?2 + Null
Null

If you use 'or', you don't get null propagation
except when you hit the special cases:


?2 or Null
2

?0 or Null
Null

?&HFFFF or Null
Null

(david)
 
True, but isn't that irrelevant when dealing with flag values?

Msgbox "This is my message", vbOkOnly + vbInformation

vs.


Msgbox "This is my message", vbOkOnly Or vbInformation
 
In my mind, it's more important that OR does not carry a one
to another bit position.

?1 + 5 + 4
10

?1 OR 5 OR 4
5

This is critically important when setting a single flag in
an existing set of flags:

x = x OR flag

will always just set the flag (whatever value Flag has), but
you have no idea what the result will be using the
expression:

x = x + flag
 
It was just an observation :~)

I got an unexpected coding failure on
iflag = iflag or v

- as you might in the general case if API SetWindowPos was expecting a
'long' flag value and you unexpectedly tried to pass it a null.

The only flags I regularly use in VB are the recordset open flags
dao.dbSeeChanges or dao.dbFailOnError.

When I have done bit operations in vb, I haven't wanted null propagation,
so the null propagation rules are important, and the exception for iflag=0
is an important case.

But I use '+' for bit operations in SQL, so I wouldn't object to somebody
using '+' for consistency

The msgbox flags are a special case :~) since most of the examples over
many years have used '+'

(david)
 
Back
Top