WS_EX_TRANSPARENT can't click on Windows 11 taskbar

46 views Asked by At

I use WS_EX_LAYERED | WS_EX_TRANSPARENT to set my full screen program as fully transparent, and mouse clicks can pass through to the underlying windows. Everything works fine on Windows 10, but the clicks don't work on the Windows 11 taskbar and the title bar of built-in programs(such as clock,settings,notepad,file explorer).

I created a picture to show where clicks are effective (in green) and where they are inactive (in red). clicks effective area

def set_clickthrough(self, hwnd: int) -> None:
    styles: int = GetWindowLong(hwnd, GWL_EXSTYLE)
    styles: int = WS_EX_LAYERED | WS_EX_TRANSPARENT
    SetWindowLong(hwnd, GWL_EXSTYLE, styles)
    SetLayeredWindowAttributes(hwnd, 0, 255, 0x00000001)
0

There are 0 answers