Jump to content

Transparency Machine


spudw2k
 Share

Recommended Posts

Add a slider to the top of the active window and set the transparency. Close the program in the sytray (by the clock).

It's not great, but kinda fun. Check it out. It's plenty open for improvement.

Mini Version

#include <GuiConstants.au3>
Global $ActiveWin

;SystemTray Layout and Hide
Opt("TrayMenuMode",1)
$trayexit = TrayCreateItem("Exit")
TraySetIcon("Shell32.dll",-75)

Global $Title = "Transparency Machine", $ActiveWin = WinGetTitle(""), $TransTitle
$WinActivePos = WinGetPos($ActiveWin)
$Left = $WinActivePos[0]

$sGUI = GuiCreate($Title, 80, 15, @DesktopWidth-180, 0, $WS_POPUP, $WS_EX_TOOLWINDOW+$WS_EX_TOPMOST)
    $slider1 = GUICtrlCreateSlider(0,0,80,14,"", $WS_EX_WINDOWEDGE)
        GUICtrlSetLimit(-1,230,0)

AdlibEnable("GuiMove", 10)

While 1
    $traymsg = TrayGetMsg() 
    if $traymsg = $trayexit then 
        ResetWindows(WinList())
        Exit
    EndIf
    $msg = GUIGetMsg()
    if $msg = $slider1 then SetTrans()
WEnd


Func SetTrans()
    if $ActiveWin <> "Transparency Machine" Then WinSetTrans($ActiveWin, "", 250-GUICtrlRead($slider1))
EndFunc

Func GuiMove()
    If WinGetTitle("") <> $Title and IsVisible(WinGetHandle("")) and WinGetTitle("") <> "Program Manager" Then
        $ActiveWin = WinGetTitle("")
        $pos = WinGetPos($ActiveWin)
        $x = $pos[0] + $pos[2] - 200
        $y = $pos[1] + 8
        GUISetState()
        WinMove($Title, "", $x, $y)
        WinSetOnTop($sGUI, "", 1)
        GUICtrlSetData($slider1,0)
    EndIf
    If WinGetTitle("") = AutoItWinGetTitle() then 
        GUISetState(@SW_HIDE)
    Else
        GUISetState()
    EndIf
EndFunc

Func ResetWindows($data)
    For $i = 1 to $data[0][0]
        If $data[$i][0] <> "" AND IsVisible($data[$i][1]) AND $data[$i][0] <> "Program Manager" Then
            WinSetTrans($data[$i][0], "", 255)
        EndIf
    Next
EndFunc

Func IsVisible($handle)
    Return BitAnd(WinGetState($handle), 2)
EndFunc
Edited by spudw2k
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...