[python-win32] make a window transparent using win32?

reckoner reckoner at gmail.com
Thu Dec 30 19:11:11 CET 2010


Dear Tim:

by the way, quick question, do you know of a way to "get" the extended 
style bits? I haven't been able to find anything on MSDN. In other 
words, if I do as you suggest below for a few windows, how can I query 
those windows again to see if those bits that I previously set using 
SetWindowLong() are indeed set?

Thanks!

On 12/28/2010 1:44 PM, Tim Roberts wrote:
> Reckoner wrote:
>> Using Python win32 extensions, how do you make an arbitrary window on
>> winXP transparent?
>
> I'll assume you already know how to find the window handle of your
> victim window.
>
> The key concept is that you need to set the WS_EX_LAYERED bit in the
> extended styles, then set the transparency level using
> SetLayeredWindowAttributes.  You can look up both APIs in MSDN for more
> detailed information.
>
>      import win32gui
>      import win32con
>      win32gui.SetWindowLong(handle, win32con.GWL_EXSTYLE,
> win32con.WS_EX_LAYERED)
>      win32gui.SetLayeredWindowAttributes(handle, 0, 128, win32con.LWA_ALPHA)
>


More information about the python-win32 mailing list