Jump to content

TransIT


sandman
 Share

Recommended Posts

I just kinda whipped this up out of boredom, but I enjoy it. I always love a little transparency in Windows to give everything that high-tech look.

Controls: Press Num-Pad Add to increase the current window's transparency, Num-Pad Subtract to decrease the current window's transparency, and Num-Pad Multiply to set a custom value between 0 and 255 and set it as the current window's transparency.

Note that all increments and decrements are RELATIVE to the current transparency of the window. They increment and decrement by 10, so if the current transparency of a window was 200, and I pressed Num-Pad Subtract, it would then be 190.

This currently is only known to work on Windows XP, please PM me if you would like to test it on Vista for me, as I don't have a Vista computer :rolleyes:

Thank you MsCreator and Valik, MsCreator for showing me Valik's WinGetTrans function, and Valik for writing it.

Aaaaaaaaaand.... the very short source code:

; TransIt
; Just a little scrap.. I find it useful though.
; MoreTrans() and LessTrans() are compatible with XP only. Vista has not yet been tested.

HotKeySet("{NUMPADADD}", "MoreTrans")
HotKeySet("{NUMPADSUB}", "LessTrans")
HotKeySet("{NUMPADMULT}", "SetTrans")

While 1
    Sleep(10)
WEnd

Func SetTrans()
    $active = WinGetTitle("")
    $input = InputBox("TransIt", "Please enter a transparency level (being between 0 and 255.")
    If $input < 0 Or $input > 255 Then
        MsgBox(0, "TransIt", "That was an invalid number!")
    Else
        WinSetTrans($active, "", Int($input))
    EndIf
EndFunc

Func MoreTrans()
    Local $active = WinGetTitle("")
    If WinGetTrans($active) = 255 Then
        ; do nothing
    Else
        WinSetTrans($active, "", WinGetTrans($active) + 10)
    EndIf
EndFunc

Func LessTrans()
    Local $active = WinGetTitle("")
    If WinGetTrans($active) = 0 Then
        ; do nothing
    Else
        WinSetTrans($active, "", WinGetTrans($active) - 10)
    EndIf
EndFunc

; I did not write the below function. It is by Valik; I acquired it through MsCreator.
Func WinGetTrans($sTitle, $sText = "")
    Local $hWnd = WinGetHandle($sTitle, $sText)
    If Not $hWnd Then Return -1
    Local $aRet = DllCall("user32.dll", "int", "GetLayeredWindowAttributes", "hwnd", $hWnd, "ptr", 0, "int_ptr", 0, "ptr", 0)
    If @error Or Not $aRet[0] Then Return -1
    Return $aRet[3]
EndFunc

Enjoy!

TransIT.au3

Edited by sandman

[center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center]

Link to comment
Share on other sites

28 views and no comments?

;(

Edited by sandman

[center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center]

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