Sign in to follow this  
Followers 0
emmanuel

Is there any way to get a Window's Transparency?

4 posts in this topic

I've got a window that I want to make transparent whenever it's not active, ala:

CODE
if not WinActive("Display Flipper") Then

WinSetTrans("Display Flipper", "", round(.50 * 255))

Else

WinSetTrans("Display Flipper", "", 255)

EndIf

However, this makes the worst flicker on the GUI ever when the window is Active as it's transparency is being set to 255 at a rapid pace.

I'd prefer to have it check if it's not transparent, then if it is, make it non-transparent.

Is there any way to get a window's transparency?


"I'm not even supposed to be here today!" -Dante (Hicks)

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

what about :

Global $WinTrans = 0
While 1

    If Not WinActive("Display Flipper") Then
        If $WinTrans <> 1 Then WinSetTrans("Display Flipper", "", Round(.50 * 255))
        $WinTrans = 1
    Else
        If $WinTrans <> 2 Then WinSetTrans("Display Flipper", "", 255)
        $WinTrans = 2
    EndIf

WEnd

:P

Edited by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Dude. JdeB to the rescue again! Thanks man. Works perfectly, don't know why I didn't think of that, I'm using similar logic in other parts of the script...


"I'm not even supposed to be here today!" -Dante (Hicks)

Share this post


Link to post
Share on other sites

Just to answer your original question, there's an API GetLayeredWindowAttributes() which will return the transparency but it's only available on Windows XP+ (SetLayeredWindowAttributes() is available on 2000+). You can use DllCall() if necessary.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0