Jump to content

Transparent Windows


death pax
 Share

Recommended Posts

Just a little Program I made earlier today ^.^

#include <GuiConstants.au3>
Opt("TrayMenuMode", 1)
HotKeySet("^+{NUMPADSUB}", "SetTrans")
$Tray_Prefs = TrayCreateItem("Preferences")
TrayCreateItem("")
$Tray_About = TrayCreateItem("About")
TrayCreateItem("")
$Tray_Exit = TrayCreateItem("Exit")
TraySetState()
While 1
    $Traymsg = TrayGetMsg()
    Select
        Case $Traymsg = $Tray_Prefs
            MsgBox(64, "Preferences:", "Preferences go Here")
        Case $Traymsg = $Tray_About
            MsgBox(64, "About:", "Transparent Windows was created by:" & @CRLF & "Death Pax of Disillusioned Designs")
        Case $Traymsg = $Tray_Exit
            ExitLoop
        Case Else
    ;;;;;;;     
    EndSelect
WEnd
Exit

Func SetTrans()
    $Window = GetActiveWindow()
    $GUI_Main = GUICreate("Transparent Windows", 343, 142, 192, 125)
    GUICtrlCreateLabel("Currently Selected Window:", 8, 8, 135, 17)
    GUICtrlCreateLabel(WinGetTitle($Window), 24, 32, 295, 17, $SS_LEFTNOWORDWRAP)
    $Slider_Transparency = GUICtrlCreateSlider(8, 56, 329, 25)
    GUICtrlSetLimit($Slider_Transparency, 100, 0)
    GUICtrlSetData($Slider_Transparency, 100)
    $Label_TransPercent = GUICtrlCreateLabel("100 %", 146, 82, 50, 25, $SS_CENTER)
    GUICtrlCreateLabel("0", 15, 82, 15, 15)
    GUICtrlCreateLabel("100", 312, 82, 25, 15)
    $Button_SetTrans = GUICtrlCreateButton("Set Transparency", 8, 106, 161, 33)
    $Button_Cancel = GUICtrlCreateButton("Cancel", 176, 106, 161, 33)
    GUICtrlSetColor(-1, 0x0080C0)
    GUISetState(@SW_SHOW)
    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE Or $msg = $Button_Cancel
                GUIDelete($GUI_Main)
                ExitLoop
            Case $msg = $Slider_Transparency
                GUICtrlSetData($Label_TransPercent, GUICtrlRead($Slider_Transparency) & " %")
            Case $msg = $Button_SetTrans
                WinSetTrans($Window, "", 255 * (GUICtrlRead($Slider_Transparency) / 100))
            Case Else
        ;;;;;;;
        EndSelect
    WEnd
EndFunc ;==>SetTrans
Func GetActiveWindow()
    Dim $return
    $var = WinList()
    For $i = 1 To $var[0][0]
        If $var[$i][0] <> "" And IsVisible($var[$i][1]) And WinActive($var[$i][1]) Then
            Return $var[$i][1]
        EndIf
    Next
EndFunc ;==>GetActiveWindow

Func IsVisible($handle)
    If BitAND( WinGetState($handle), 2) Then
        Return 1
    Else
        Return 0
    EndIf
EndFunc ;==>IsVisible

Later on i do plan on adding a preferences screen to change the hotkey, and add an ini file to store it in

Any Comments/Suggestions are welcome, and if anyone knows how to retrieve current transparency of a window, plz tell me ^.^

Edited by death pax
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...