SetWindowPos function (winuser.h)


i was playing with setwindowpos function and reading the documentation of it

and i notices this part

[in] uFlags

Type: UINT

The window sizing and positioning flags. This parameter can be a combination of the following values.

it says i can use a combination of flags

for example if i want the window to be on top and at the same time not change its current position
i should be using those flags ( 0x0010 , 0x0002 , 0x0001 )
but when i try to evaluate the code like this
( python.import “ctypes” ).windll.user32.SetWindowPos hwnd 0 0 0 0 0 0x0010 , 0x0002 , 0x0001

only the first flag is considered and the rest is ignored

any idea of a way to use multiple flags ?


use bit struct methods to combine them
flags = bit.or 0x0001 (bit.or 0x0010 0x0002)


i searched a little and also found that i can sum the code numbers
for example i can use 0x0013 which is ( 0x0010 , 0x0002 , 0x0001 ) combined :slight_smile:


yes, if all values are different

a = 0x0001
b = 0x0020
c = 0x0300

a + b + c == bit.or a (bit.or b c )

a = 0x0001
b = 0x0001
c = 0x0300

a + b + c == bit.or a (bit.or b c )




wasn’t aware of that thanks alot man