Jump to content

Need help emulating something i noticed on Win Vista


Recommended Posts

Hi!

I noticed today while running Vista that if you put the Sidebar on "Always on top" and then maximize a window (anyone) it gets opaque instead of transparent and that got me wondering..... Would that effect be possible to get with AutoIt??

My first thought was I needed to trap some windows message but i dont have a clue where to start :)

I also gave "Winspector Spy" a try but couldn't really understand it by myself and the help wouldn't open and on top of that it didn't seem to work as supposed Vista....

I would be really happy if someone could give me some help with this!! ;)

Edited by TzarAlkex
Link to comment
Share on other sites

I'm confused are you saying that when you have the sidebar set to "Always on top", a maximized window will override this?

Maybe I could have explained in a better way... in Windows Vista you have a app called Windows Sidebar which is basically a Appbar(application desktop toolbar). It works in the same manner of the Taskbar (can work as a normal window or be there permanently)

It would be much easier if you could google or just try for yourself cause i am not really good at explaining things......

Oh and also plz excuse me for a late reply but something is not rigth on my internet (it first worls a few secs and then doesn't for a much longer time making anything on the internet really hard to do)

Edited by TzarAlkex
Link to comment
Share on other sites

I am clear on what the Sidebar is; however, I cannot visualize what is happening without running Vista myself.

I noticed today while running Vista that if you put the Sidebar on "Always on top" and then maximize a window (anyone) it gets opaque instead of transparent

In this line you say "it gets opaque", are you referring to the Sidebar or to the newly maximized window?

And just for clarity, when you say "opaque" you mean NOT transparent whatsoever.

Edited by weaponx
Link to comment
Share on other sites

In the settings for the Sidebar you have a checkbox with the text "Sidebar is always on top of other windows".

When that is on but no window are maximized the Sidebar is transparent, i. e. you can for example see your wallpaper through it.

When it is on but you have something maximized(but not also minimized!!) the Sidebar gets opaque, i. e. nothing gets through it, you only see a solid color

Edited by TzarAlkex
Link to comment
Share on other sites

When a window is maximized use

WinSetTrans ( "title", "text", transparency )

to make it opaque and back again when restored?

Link to comment
Share on other sites

When a window is maximized use

WinSetTrans ( "title", "text", transparency )

to make it opaque and back again when restored?

Two things about that....

1. How the heck would i do that, and even if i found out a way wouldn't it require large loops that consume much CPU??

2. That would confine me to Win 2000 or later (i like to have as few restraints as possible)

In my opinion SetBitmap would be better in my case and I am experimenting with it right now, the real problem I think would be to know when it exists a maximized window..... (hopefully avoiding large loops and such that eat all our cpu)

Edited by TzarAlkex
Link to comment
Share on other sites

Two things about that....

1. How the heck would i do that, and even if i found out a way wouldn't it require large loops that consume much CPU??

Just do a check against a window when it gets focus, take a look at WinWaitNotActive.

2. That would confine me to Win 2000 or later (i like to have as few restraints as possible)

Why not mention that in your first post?

In my opinion SetBitmap would be better in my case and I am experimenting with it right now, the real problem I think would be to know when it exists a maximized window..... (hopefully avoiding large loops and such that eat all our cpu)

WinWaitNotActive and a simple check when it changes.

EDIT: WinWaitActive//WinWaitNotActive

Edited by Uten
Link to comment
Share on other sites

Hi again!!

I just had to post some answers to Uten and show you a TEMPORARY solution i maneged to code, it works but could probably be improved a lot :P

AdlibEnable("Adlib", 2500)
Func Adlib()
    $WinList = WinList()
    $Maximized = 0
    For $List3 = 1 To $WinList[0][0]
        $State = WinGetState($WinList[$List3][1])
        If BitAnd($State, 32) Then $Maximized = 1
    Next
    If $Maximized = 1 Then
        WinSetTrans("SomeApp", "", 255)
    Else
        WinSetTrans("SomeApp", "", 230)
    EndIf
EndFunc

Just do a check against a window when it gets focus, take a look at WinWaitNotActive.

I really dont understand what this has to do with anything, i believe one of us have missunderstood the other :)

Why not mention that in your first post?

You like restraints?? ;)

WinWaitNotActive and a simple check when it changes.

Same as two steps above.....
Link to comment
Share on other sites

2. That would confine me to Win 2000 or later (i like to have as few restraints as possible)

If you want transparency you're gonna be stuck with that restraint anyway. IIRC nothing before Win2k allowed for transparent windows (except for some 3rd party software). Unless you want to go from HIDDEN to VISIBLE? But I interpreted your post to mean you wanted to go from semi-transparent to fully opaque.

Link to comment
Share on other sites

If you want transparency you're gonna be stuck with that restraint anyway. IIRC nothing before Win2k allowed for transparent windows (except for some 3rd party software). Unless you want to go from HIDDEN to VISIBLE? But I interpreted your post to mean you wanted to go from semi-transparent to fully opaque.

As far as I know, the WinSetTrans only works on systems that support it, but give no problem when tried on a system that doesn't support it. So you can just fire the command anyway, and it will just not work when in pre-trans-age OS. But then again, since you only need it in Vista, why not first check @OSVersion and only do the command if you have Vista?

Just my 2 ct.

Roses are FF0000, violets are 0000FF... All my base are belong to you.

Link to comment
Share on other sites

If you want transparency you're gonna be stuck with that restraint anyway. IIRC nothing before Win2k allowed for transparent windows (except for some 3rd party software). Unless you want to go from HIDDEN to VISIBLE? But I interpreted your post to mean you wanted to go from semi-transparent to fully opaque.

My idea was to try the method lod3n used here since that method uses the GDI+ dll which is available to Win98 and upwards I was hoping that would work, but I have neither converted my guis to .png or installed Win98 so that will have to wait cause i must get some sleep now...... (time is 1 am here and I am almost sleeping on the keyboard) :)
Link to comment
Share on other sites

But then again, since you only need it in Vista, why not first check @OSVersion and only do the command if you have Vista?

When did I say that??
Link to comment
Share on other sites

#include <GUIConstants.au3>

Dim $hActive, $hMaximized, $bIsOpaque = False
$gui = GUICreate('', 200, 200)
    WinSetOnTop($gui, '', 1)
    WinSetTrans($gui, '', 128)
GUISetState()

While 1
    $hCheckActive = WinGetHandle('[ACTIVE]'); Get handle of active window
    If $hActive <> $hCheckActive Then; If active window has changed...
        $hMaximized = _FindMaximized(); Look for maximized windows, store in $hMaximized for later reference
        If $hMaximized Then; If a max'd window is found...
            _SetOpaque(True, $bIsOpaque)
        Else; If not...
            _SetOpaque(False, $bIsOpaque)
        EndIf
        $hActive = $hCheckActive
    Else; If active window has NOT changed...
        $iState = WinGetState($hActive); Get the state of the active window
        If BitAND($iState, 32) Then; If active window is maximized, go opaque
            $hMaximized = $hActive
            _SetOpaque(True, $bIsOpaque)
        ElseIf $hMaximized = $hActive Then; If active window is NOT maximized, but WAS maximized before...
            $hMaximized = _FindMaximized(); Look for any other maximized windows, store in $hMaximized for later reference
            If Not $hMaximized Then; If no max'd window is found...
                _SetOpaque(False, $bIsOpaque)
            EndIf
        EndIf
    EndIf

    $gm = GUIGetMsg()
    Switch $gm
        Case $GUI_EVENT_CLOSE
            ExitLoop
    EndSwitch
WEnd

Func _SetOpaque($bGoOpaque, ByRef $bIsOpaque, $i = @ScriptLineNumber)
    If Not $bGoOpaque And $bIsOpaque Then
        WinSetTrans($gui, '', 128)
    ElseIf $bGoOpaque And Not $bIsOpaque Then
        WinSetTrans($gui, '', 255)
    EndIf
    $bIsOpaque = $bGoOpaque
EndFunc

Func _FindMaximized()
    Local $aWinList, $iState
    $aWinList = WinList()
    For $i = 1 to $aWinList[0][0]
        $iState = WinGetState($aWinList[$i][1])
        If BitAND($iState, 32) And BitAND($iState, 2) Then Return $aWinList[$i][1]
    Next
    Return False
EndFunc

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...