Rorka Posted April 19, 2009 Share Posted April 19, 2009 How would i make a transparent Window but with the text to stay shown? Here is what i have played around with? expandcollapse popup#include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $PaintWindow = GUICreate("PaintWindow", 235, 85, 193, 125, BitOR($WS_SYSMENU,$WS_POPUP,$WS_POPUPWINDOW,$WS_BORDER), 0) _GUICreateInvRect($PaintWindow, 1, 1, 235, 85) $title = GUICtrlCreateLabel("lable1", 8, 8, 73, 17) $Statuslable = GUICtrlCreateLabel("Status: Idle", 152, 8, 57, 17) $castnum = GUICtrlCreateLabel("Number of casts: 0", 8, 32, 93, 17) $Baitnum = GUICtrlCreateLabel("Bait used: 0", 152, 32, 60, 17) $Accurseynum = GUICtrlCreateLabel("% Caught: N/A", 8, 56, 75, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _GUICreateInvRect($hwnd, $l, $t, $w, $h) $pos = WinGetPos($hwnd) $1 = 0 $2 = 0 $3 = $pos[2] $4 = $t $ret = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", $1, "long", $2, "long", $3, "long", $4) $1 = 0 $2 = 0 $3 = $l $4 = $pos[3] $ret2 = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", $1, "long", $2, "long", $3, "long", $4) $1 = $l + $w $2 = 0 $3 = $pos[2] $4 = $pos[3] $ret3 = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", $1, "long", $2, "long", $3, "long", $4) $1 = 0 $2 = $t + $h $3 = $pos[2] $4 = $pos[3] $ret4 = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", $1, "long", $2, "long", $3, "long", $4) DllCall("gdi32.dll", "long", "CombineRgn", "long", $ret[0], "long", $ret[0], "long", $ret2[0], "int", 2) DllCall("gdi32.dll", "long", "CombineRgn", "long", $ret[0], "long", $ret[0], "long", $ret3[0], "int", 2) DllCall("gdi32.dll", "long", "CombineRgn", "long", $ret[0], "long", $ret[0], "long", $ret4[0], "int", 2) DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $hwnd, "long", $ret[0], "int", 1) EndFunc Thanks Link to comment Share on other sites More sharing options...
picea892 Posted April 19, 2009 Share Posted April 19, 2009 You can use regions or layers. This answer has been recently answered. Would Melba's example work for you?http://www.autoitscript.com/forum/index.php?showtopic=92964 Link to comment Share on other sites More sharing options...
Rorka Posted April 19, 2009 Author Share Posted April 19, 2009 You can use regions or layers. This answer has been recently answered. Would Melba's example work for you?http://www.autoitscript.com/forum/index.php?showtopic=92964Yes it does... but it need to always be ontop... and $WS_EX_TOPMOST make the window shown again Link to comment Share on other sites More sharing options...
picea892 Posted April 20, 2009 Share Posted April 20, 2009 I suppose you could just insert this line. WinSetOnTop("PaintWindow","",1) Link to comment Share on other sites More sharing options...
yehia Posted April 20, 2009 Share Posted April 20, 2009 ucan use the GDI+funcs to make that look nice like a layered or transparent png on top My Scripts:IE New UDFsElastic images moving under mouse (with a happy valentine's example)_FileRemoveLine Link to comment Share on other sites More sharing options...
ResNullius Posted April 20, 2009 Share Posted April 20, 2009 If you only need it for displaying text, perhaps this (originally posted by Larry) will do expandcollapse popup;Larry(DaLooza) ; #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> $hwnd = GUICreate("Text Region",400,50,-1,-1,$WS_POPUP,BitOR($WS_EX_TOPMOST,$WS_EX_TOOLWINDOW)) GUISetBkColor(0x00FF00) $rgn = CreateTextRgn($hwnd,"Larry Rocks!",50,"Arial",1000) SetWindowRgn($hwnd,$rgn) GUISetState() Sleep(3000) $rgn = CreateTextRgn($hwnd,"Really Really",50,"Arial",1000) SetWindowRgn($hwnd,$rgn) Sleep(3000) Func SetWindowRgn($h_win, $rgn) DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $rgn, "int", 1) EndFunc Func CreateTextRgn(ByRef $CTR_hwnd,$CTR_Text,$CTR_height,$CTR_font="Microsoft Sans Serif",$CTR_weight=1000) Local Const $ANSI_CHARSET = 0 Local Const $OUT_CHARACTER_PRECIS = 2 Local Const $CLIP_DEFAULT_PRECIS = 0 Local Const $PROOF_QUALITY = 2 Local Const $FIXED_PITCH = 1 Local Const $RGN_XOR = 3 If $CTR_font = "" Then $CTR_font = "Microsoft Sans Serif" If $CTR_weight = -1 Then $CTR_weight = 1000 Local $gdi_dll = DLLOpen("gdi32.dll") Local $CTR_hDC= DLLCall("user32.dll","int","GetDC","hwnd",$CTR_hwnd) Local $CTR_hMyFont = DLLCall($gdi_dll,"hwnd","CreateFont","int",$CTR_height,"int",0,"int",0,"int",0, _ "int",$CTR_weight,"int",0,"int",0,"int",0,"int",$ANSI_CHARSET,"int",$OUT_CHARACTER_PRECIS, _ "int",$CLIP_DEFAULT_PRECIS,"int",$PROOF_QUALITY,"int",$FIXED_PITCH,"str",$CTR_font ) Local $CTR_hOldFont = DLLCall($gdi_dll,"hwnd","SelectObject","int",$CTR_hDC[0],"hwnd",$CTR_hMyFont[0]) DLLCall($gdi_dll,"int","BeginPath","int",$CTR_hDC[0]) DLLCall($gdi_dll,"int","TextOut","int",$CTR_hDC[0],"int",0,"int",0,"str",$CTR_Text,"int",StringLen($CTR_Text)) DLLCall($gdi_dll,"int","EndPath","int",$CTR_hDC[0]) Local $CTR_hRgn1 = DLLCall($gdi_dll,"hwnd","PathToRegion","int",$CTR_hDC[0]) Local $CTR_rc = DLLStructCreate("int;int;int;int") DLLCall($gdi_dll,"int","GetRgnBox","hwnd",$CTR_hRgn1[0],"ptr",DllStructGetPtr($CTR_rc)) Local $CTR_hRgn2 = DLLCall($gdi_dll,"hwnd","CreateRectRgnIndirect","ptr",DllStructGetPtr($CTR_rc)) DLLCall($gdi_dll,"int","CombineRgn","hwnd",$CTR_hRgn2[0],"hwnd",$CTR_hRgn2[0],"hwnd",$CTR_hRgn1[0],"int",$RGN_XOR) DLLCall($gdi_dll,"int","DeleteObject","hwnd",$CTR_hRgn1[0]) DLLCall("user32.dll","int","ReleaseDC","hwnd",$CTR_hwnd,"int",$CTR_hDC[0]) DLLCall($gdi_dll,"int","SelectObject","int",$CTR_hDC[0],"hwnd",$CTR_hOldFont[0]) DLLClose($gdi_dll) Return $CTR_hRgn2[0] EndFunc Link to comment Share on other sites More sharing options...
Rorka Posted April 20, 2009 Author Share Posted April 20, 2009 Thank you everybody. With a little work I got Melba's example, to do just what I needed:) 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