Can anyone explain to me how these constants in win32con are picked apart?

56 Views Asked by At

What I'm trying to do is find out what is fullscreen or exclusive fullscreen. The code I have is to generate the styles of the open windows on my desktop. WS_MAXIMIZE has a different numbers then what is being printed by the code. Can someone explain to me how these numbers are being generated by windows?

SO you know Siper-Man is exclusive fullscreen, and pot player is fullscreen while playing a video.

from win32gui import GetWindowLong, GetWindowText
from pyvda import AppView, get_apps_by_z_order  # noqa
from datetime import datetime
import win32con
import inspect

# Spider-Man: Exclusive Fullscreen
tinmestamp = datetime.now().timestamp()
while datetime.now().timestamp() - tinmestamp < 10:
    continue

with open('GWL.txt', 'w') as file:
    for key, value in [member for member in inspect.getmembers(win32con) if 'GWL' in member[0]]:
        file.write(f'{key + ": int":35} = {value}\n')

with open('256.txt', 'w') as file:
    for key, value in [member for member in inspect.getmembers(win32con) if member[1] == 256]:
        file.write(f'{key + ": int":35} = {value}\n')

with open('WS.txt', 'w') as file:
    for key, value in [member for member in inspect.getmembers(win32con) if member[0].startswith('WS_')]:
        file.write(f'{key + ": int":35} = {value}\n')

with open('win32con.txt', 'w') as file:
    for key, value in [member for member in inspect.getmembers(win32con) if member[0].isupper()]:
        file.write(f'{key + ": int":35} = {value}\n')


print(f'{"MAXIMIZED":>12}')
windows = [window for window in get_apps_by_z_order(current_desktop = False) if (GetWindowLong(window.hwnd, win32con.GWL_STYLE) & win32con.WS_MAXIMIZE)]
for window in windows:
    print(f'{GetWindowText(window.hwnd)}')
print()

print(f'{"GWL_STYLE":>12}')
for window in get_apps_by_z_order(current_desktop = False):
    print(f'{GetWindowLong(window.hwnd, win32con.GWL_STYLE):<15} {GetWindowText(window.hwnd)}')
print()

print(f'{"GWL_EXSTYLE":>14}')
for window in get_apps_by_z_order(current_desktop = False):
    print(f'{GetWindowLong(window.hwnd, win32con.GWL_EXSTYLE):<15} {GetWindowText(window.hwnd)}')
output:

   MAXIMIZED
MonitorPowerUtility – topmost.py
Alienware Command Center

   GWL_STYLE
369098752       Marvel's Spider-Man Remastered v2.616.0.0
399441920       MonitorPowerUtility – topmost.py
-1781596160     Alienware Command Center
382664704       Can anyone explain to me how these constants in win32con are picked apart? - Stack Overflow — Mozilla Firefox
-1764818944     FBI - S02E14 - Studio Gangster.mkv - PotPlayer

   GWL_EXSTYLE
8               Marvel's Spider-Man Remastered v2.616.0.0
256             MonitorPowerUtility – topmost.py
2097408         Alienware Command Center
256             Can anyone explain to me how these constants in win32con are picked apart? - Stack Overflow — Mozilla Firefox
262416          FBI - S02E14 - Studio Gangster.mkv - PotPlayer
Generated WS.txt file:

WS_ACTIVECAPTION: int               = 1
WS_BORDER: int                      = 8388608
WS_CAPTION: int                     = 12582912
WS_CHILD: int                       = 1073741824
WS_CHILDWINDOW: int                 = 1073741824
WS_CLIPCHILDREN: int                = 33554432
WS_CLIPSIBLINGS: int                = 67108864
WS_DISABLED: int                    = 134217728
WS_DLGFRAME: int                    = 4194304
WS_EX_ACCEPTFILES: int              = 16
WS_EX_APPWINDOW: int                = 262144
WS_EX_CLIENTEDGE: int               = 512
WS_EX_COMPOSITED: int               = 33554432
WS_EX_CONTEXTHELP: int              = 1024
WS_EX_CONTROLPARENT: int            = 65536
WS_EX_DLGMODALFRAME: int            = 1
WS_EX_LAYERED: int                  = 524288
WS_EX_LAYOUTRTL: int                = 4194304
WS_EX_LEFT: int                     = 0
WS_EX_LEFTSCROLLBAR: int            = 16384
WS_EX_LTRREADING: int               = 0
WS_EX_MDICHILD: int                 = 64
WS_EX_NOACTIVATE: int               = 134217728
WS_EX_NOINHERITLAYOUT: int          = 1048576
WS_EX_NOPARENTNOTIFY: int           = 4
WS_EX_OVERLAPPEDWINDOW: int         = 768
WS_EX_PALETTEWINDOW: int            = 392
WS_EX_RIGHT: int                    = 4096
WS_EX_RIGHTSCROLLBAR: int           = 0
WS_EX_RTLREADING: int               = 8192
WS_EX_STATICEDGE: int               = 131072
WS_EX_TOOLWINDOW: int               = 128
WS_EX_TOPMOST: int                  = 8
WS_EX_TRANSPARENT: int              = 32
WS_EX_WINDOWEDGE: int               = 256
WS_GROUP: int                       = 131072
WS_HSCROLL: int                     = 1048576
WS_ICONIC: int                      = 536870912
WS_MAXIMIZE: int                    = 16777216
WS_MAXIMIZEBOX: int                 = 65536
WS_MINIMIZE: int                    = 536870912
WS_MINIMIZEBOX: int                 = 131072
WS_OVERLAPPED: int                  = 0
WS_OVERLAPPEDWINDOW: int            = 13565952
WS_POPUP: int                       = -2147483648
WS_POPUPWINDOW: int                 = -2138570752
WS_SIZEBOX: int                     = 262144
WS_SYSMENU: int                     = 524288
WS_TABSTOP: int                     = 65536
WS_THICKFRAME: int                  = 262144
WS_TILED: int                       = 0
WS_TILEDWINDOW: int                 = 13565952
WS_VISIBLE: int                     = 268435456
WS_VSCROLL: int                     = 2097152
0

There are 0 best solutions below