Jump to content

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


emmanuel
 Share

Recommended Posts

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)

Link to comment
Share on other sites

  • Developers

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

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
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)

Link to comment
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.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...