Vision Posted December 22, 2010 Share Posted December 22, 2010 hello! im trying to make my gui transparent but i want just the background transparent not the controls so Winsettrans will not work in my way. i found in the help files _WinAPI_SetLayeredWindowAttributes but it has no effect in my script, in the example it works good anyone knows why? here is my "test" script expandcollapse popup#include <GUIConstantsEx.au3> #include <ButtonConstants.au3> #include <StaticConstants.au3> #include <WINAPI.au3> #include <WindowsConstants.au3> #include <GuiButton.au3> #include <GuiImageList.au3> Global $Cursor1, $Button1 $gui = GUICreate("Test", 300, 200, -1, -1) GUISetStyle($WS_POPUP, -1, $gui) ; NO BORDERS $label = GUICtrlCreateButton("test", 30, 50, 50, 120, $BS_BITMAP) $cursor = GUIGetCursorInfo() _WinAPI_SetLayeredWindowAttributes($gui, 0xABCDEF,255) ; <-- Why this dont make the window transparent? GUISetState() AdlibRegister("_Hover_Label") Func _Hover_Label() $pos = GUIGetCursorInfo() If $pos[4] = $label Then _GUICtrlButton_SetSize($label, 50, 120) Else _GUICtrlButton_SetSize($label, 20, 100) EndIf EndFunc While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 EndSwitch WEnd Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 22, 2010 Moderators Share Posted December 22, 2010 Vision,Firstly you need to set the $WS_EX_LAYERED extended style.Secondly, you need to set the GUI background to the colour you later make transparent.So you end up with this (look for the <<<<<<<<< lines):expandcollapse popup#include <GUIConstantsEx.au3> #include <ButtonConstants.au3> #include <StaticConstants.au3> #include <WINAPI.au3> #include <WindowsConstants.au3> #include <GuiButton.au3> #include <GuiImageList.au3> Global $Cursor1, $Button1 $gui = GUICreate("Test", 300, 200, -1, -1) GUISetBkColor(0xABCDEF) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< GUISetStyle($WS_POPUP, $WS_EX_LAYERED, $gui) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $label = GUICtrlCreateButton("test", 30, 50, 50, 120, $BS_BITMAP) $cursor = GUIGetCursorInfo() _WinAPI_SetLayeredWindowAttributes($gui, 0xABCDEF,255) ; <-- It does now! <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< GUISetState() AdlibRegister("_Hover_Label") Func _Hover_Label() $pos = GUIGetCursorInfo() If $pos[4] = $label Then _GUICtrlButton_SetSize($label, 50, 120) Else _GUICtrlButton_SetSize($label, 20, 100) EndIf EndFunc While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 EndSwitch WEndAll clear? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Vision Posted December 22, 2010 Author Share Posted December 22, 2010 (edited) perfect! thanks much (would be good if this "trick" would be in the help file^^) one additional mini question can yo give me a tip how i can fix that the program crashes when i click something outside the program? the array returned from GUIGetCursorInfo() does a critical ERROR Edited December 22, 2010 by Vision Link to comment Share on other sites More sharing options...
smashly Posted December 22, 2010 Share Posted December 22, 2010 Hi, Func _Hover_Label() $pos = GUIGetCursorInfo() If IsArray($pos) And $pos[4] = $label Then _GUICtrlButton_SetSize($label, 50, 120) Else _GUICtrlButton_SetSize($label, 20, 100) EndIf EndFunc Cheers Link to comment Share on other sites More sharing options...
JoHanatCent Posted December 22, 2010 Share Posted December 22, 2010 can yo give me a tip how i can fix that the program crashes when i click something outside the program?the array returned from GUIGetCursorInfo() does a critical ERRORWinGetPos($GUI)or else just use_MouseTrap Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now