Jump to content

Transparent gui background


jebus495
 Share

Recommended Posts

Wanted to make a simple script to set on top of the title bar of a video game to control my music without tabbing out to change etc.

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Include <WinAPI.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 633, 35, 192, 124, $WS_POPUP, $WS_EX_LAYERED)
$play = GUICtrlCreateButton("Play", 8, 4, 35, 25, $WS_GROUP)
$stop = GUICtrlCreateButton("Stop", 48, 4, 35, 25, $WS_GROUP)
$back = GUICtrlCreateButton("Back", 88, 4, 35, 25, $WS_GROUP)
$next = GUICtrlCreateButton("Next", 128, 4, 35, 25, $WS_GROUP)
$Label1 = GUICtrlCreateLabel("Song = ", 176, 8, 66, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFFFFFF)
_WinAPI_SetLayeredWindowAttributes($Form1, 0xABCDEF, 255)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

I looked at the help file for _WinAPI_SetLayeredWindowAttributes() and as near as I can tell I've done the exact same thing as in the example but am not producing the same result. Obviously something isn't right and I have no idea what's up. It's probably something stupid I missed but I can't for the life of me figure it out.

I can not seem to make my background transparent like in the example.

=\

Link to comment
Share on other sites

After a good nights rest I figured out what was going on.

_WinAPI_SetLayeredWindowAttributes()

It sets the current color of your gui as transparent.

$Form1 = GUICreate("Form1", 633, 35, 192, 124, $WS_POPUP, $WS_EX_LAYERED)
_WinAPI_SetLayeredWindowAttributes($Form1, 0x0000F4, 255)

^ will not work

$Form1 = GUICreate("Form1", 633, 35, 192, 124, $WS_POPUP, $WS_EX_LAYERED)
GUISetBkColor(0xABCDEF)
_WinAPI_SetLayeredWindowAttributes($Form1, 0x0000F4, 255)

^ also will not work

$Form1 = GUICreate("Form1", 633, 35, 192, 124, $WS_POPUP, $WS_EX_LAYERED)
GUISetBkColor(0xABCDEF)
_WinAPI_SetLayeredWindowAttributes($Form1, 0xABCDEF, 255)

^ does work :(

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