Sign in to follow this  
Followers 0
Tomb

transparency

4 posts in this topic

would it be possible to get an $WS_EX_LAYERED sort of transparent effect on a child gui with a pic on it which is set a mdi child with DllCall("user32.dll", "hwnd", "SetParent", "hwnd", $CHILD, "hwnd", $GUI).

Share this post


Link to post
Share on other sites



would it be possible to get an $WS_EX_LAYERED sort of transparent effect on a child gui with a pic on it which is set a mdi child with DllCall("user32.dll", "hwnd", "SetParent", "hwnd", $CHILD, "hwnd", $GUI).

I don't think so

$WS_EX_LAYERED 0x00080000 Creates a layered window. Note that this cannot be used for child windows.

But you can have a transparent child window.

I think this example might have been by Siao,

#include <GuiConstantsEx.au3>
#include <windowsconstants.au3>

Const $WS_EX_COMPOSITED = 0x2000000

$Main_GUI = GUICreate("Main",500,500,-1,-1, -1,$WS_EX_COMPOSITED);$WS_EX_TRANSPARENT
;~ GUISetBkColor(0xffffff)
$Btn_Exit = GUICtrlCreateButton("E&xit", 10, 10, 90, 20)
GUICtrlCreateLabel("aaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa",200,80,50,50, -1,$WS_EX_TRANSPARENT)
GUIctrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT)
GUISetState(@SW_SHOW, $Main_GUI)
$Child_GUI = GUICreate("Child", 100, 100, 10, 50, $WS_CHILD, BitOR($WS_EX_TRANSPARENT,$WS_EX_TOPMOST), $Main_GUI)
;~ GUISetBkColor(0xffffff)
$label=GUICtrlCreateLabel("bbbbbbbbbbbbbbb bbbbbbbbbb bbbbbbbbbbbbb bbbbbbbb",5,5,50,50, -1,-1)
GUIctrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT)
$Btn_Test = GUICtrlCreateButton("Test", 10, 10, 90, 20)
GUISetState(@SW_SHOW, $Child_GUI)
$i=10
WinSetState($Main_GUI,"",$GUI_HIDE)
While 1
    $i+=1
    $msg=GUIGetMsg()
    If $msg=$GUI_EVENT_CLOSE Or $msg=$Btn_Exit Then Exit
    If $msg=$Btn_Test Then MsgBox(0, "Test", "Hit Button on Child Window")
   ;WinMove($Child_GUI,"",$i,50)
    ControlMove($Child_GUI,"",$label,5,5+$i)
    Sleep(70)
WEnd

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

thanks martin. i think im just trying to do the impossible.

i will look for an alternate solution.

Share this post


Link to post
Share on other sites

thanks martin. i think im just trying to do the impossible.

i will look for an alternate solution.

You could have a window which is layered but not a child and keep it inside the 'parent' by having registering $WM_MOVE and writing some code to keep the layered window within the parent.

Another way is to use $WS_EX_MDICHILD which simulates a child window.

#include <GUIConstants.au3>
#include <misc.au3>
#include <windowsconstants.au3>
#include <editconstants.au3>
#include <sendmessage.au3>
HotKeySet("{F11}","fadeaway")

$gui=GUICreate("test transparentpic", 200, 100,-1,-1);,BitOR($WS_POPUP,$WS_SIZEBOX))
$ed = GUICtrlCreateEdit("hgh",0,0,200,100,BitOR($ES_WANTRETURN, $ES_AUTOVSCROLL, $WS_VSCROLL, $ES_MULTILINE, $ES_NOHIDESEL))
;$pic=GUICreate("", 68, 71, 10, 10,$WS_POPUP,$WS_EX_MDICHILD,$gui);BitOr($WS_EX_LAYERED,$WS_EX_MDICHILD),$gui)
$pic=GUICreate("", 68, 71, 10, 10,$WS_POPUP,BitOr($WS_EX_LAYERED,$WS_EX_MDICHILD),$gui)
$pic1 = GUICtrlCreatePic(@Systemdir & "\oobe\images\merlin.gif",0,0, 0,0)

GUISetState(@SW_SHOW,$pic)
GUISetState(@SW_SHOW,$gui)

HotKeySet("{ESC}", "main")

do
    $msg = GUIGetMsg()
    switch $msg
        Case $pic1
            _SendMessage($gui,$WM_SYSCOMMAND,0xf012);so you can drag by pic
            
    EndSwitch
    
until $msg = $GUI_EVENT_CLOSE
Fadeaway()
sleep(2000)
Exit

Func main()
    $guiPos = WinGetPos($gui)
    WinMove($gui,"",$guiPos[0]+10,$guiPos[1]+10)
EndFunc

Func Fadeaway()
WinSetTrans($gui,'',30) 
    
EndFunc

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
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
Sign in to follow this  
Followers 0