Jump to content

Winsettrans with $WS_CHILD not possible ?


jennico
 Share

Recommended Posts

$parent=GUICreate("")

GUISetState()

$child=GUICreate("",100,100,10,10 , 0x40000000, -1, $parent);$WS_CHILD

GUISetBkColor(0xF20000)

GUISetState()

Sleep(2000)

MsgBox(0,"setting trans",WinSetTrans($child,"",20))

MsgBox(0,"","does not work")

no trans for a child or wrong code ?

thx j.

Edited by jennico
Spoiler

I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.OixB7.jpgDon't forget this IP: 213.251.145.96

 

Link to comment
Share on other sites

:mellow: not mentioned in help file

Hmm... like this?

#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>

Global Const $SPI_GETWORKAREA = 48

$parent = GUICreate("Test", 300, 200)

GUICtrlCreateLabel("Hello world!", 100, 50, 100, 15)

$child = GUICreate("", 100, 100, -1, -1, BitOR($WS_VISIBLE, $WS_POPUP), -1, $parent)
GUISetState(@SW_DISABLE)
GUISetBkColor(0xF20000)
WinSetTrans($child, "", 20)

GUISetState(@SW_SHOW, $parent)

GUIRegisterMsg($WM_WINDOWPOSCHANGING, "_WndProc")
GUIRegisterMsg($WM_ACTIVATE, "_WndProc")

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

Func _WndProc($hWnd, $Msg, $wParam, $lParam)
    Switch $hWnd
        Case $parent
            Switch $Msg
                Case $WM_ACTIVATE
                    Local $wActive = BitAND($wParam, 0x0000FFFF)
                    If $wActive Then
                        Local $aPos = WinGetPos($parent)
                        WinMove($child, "", $aPos[0] + 100, $aPos[1] + 65)
                    EndIf
                Case $WM_WINDOWPOSCHANGING
                    Local $WINDOWPOS = DllStructCreate("hwnd hWnd;hwnd hwndInsertAfter;int x;int y;int cx;int cy;uint flags", $lParam)
                    Local $iX = DllStructGetData($WINDOWPOS, "x")
                    Local $iY = DllStructGetData($WINDOWPOS, "y")
                    ;Local $iWidth = DllStructGetData($WINDOWPOS, "cx")
                    ;Local $iHeight = DllStructGetData($WINDOWPOS, "cy")
                    
                    WinMove($child, "", $iX + 100, $iY + 65)
            EndSwitch
    EndSwitch           
    
    Return $GUI_RUNDEFMSG
EndFunc
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...