myspacee Posted January 16, 2009 Share Posted January 16, 2009 (edited) In these day i'm boring example section board with my silly request. Martin do a working example for my request. Made GUI with holes that cover an application but make visible/clickable only part of it: expandcollapse popup#include <GUIConstantsEx.au3> #include <windowsconstants.au3> #include <staticconstants.au3> #region - GUI Create ;OPt("GUIEventOptions",0) $gui = GUICreate("trans", 300, 400, -1, -1, BitOr($WS_POPUP,$WS_SIZEBOX), $WS_EX_LAYERED) GUICtrlCreateButton("",50,50,100,100,$WS_SIZEBOX) GUICtrlSetBkColor(-1,0xABCDEF) _API_SetLayeredWindowAttributes($gui,0xABCDEF) GUISetState() While GUIGetMsg() <> -3 sleep(100) WEnd #endregion ;=============================================================================== ; ; Function Name: _API_SetLayeredWindowAttributes ; Description:: Sets Layered Window Attributes:) See MSDN for more informaion ; Parameter(s): ; $hwnd - Handle of GUI to work on ; $i_transcolor - Transparent color ; $Transparency - Set Transparancy of GUI ; $isColorRef - If True, $i_transcolor is a COLORREF-Strucure, else an RGB-Color ; Requirement(s): Layered Windows ; Return Value(s): Success: 1 ; Error: 0 ; @error: 1 to 3 - Error from DllCall ; @error: 4 - Function did not succeed - use ; _WinAPI_GetLastErrorMessage or _WinAPI_GetLastError to get more information ; Author(s): Prog@ndy ; ;=============================================================================== ; Func _API_SetLayeredWindowAttributes($hwnd, $i_transcolor, $Transparency = 255, $isColorRef = False) Local Const $AC_SRC_ALPHA = 1 Local Const $ULW_ALPHA = 2 Local Const $LWA_ALPHA = 0x2 Local Const $LWA_COLORKEY = 0x1 If Not $isColorRef Then $i_transcolor = Hex(String($i_transcolor), 6) $i_transcolor = Execute('0x00' & StringMid($i_transcolor, 5, 2) & StringMid($i_transcolor, 3, 2) & StringMid($i_transcolor, 1, 2)) EndIf Local $Ret = DllCall("user32.dll", "int", "SetLayeredWindowAttributes", "hwnd", $hwnd, "long", $i_transcolor, "byte", $Transparency, "long", $LWA_COLORKEY + $LWA_ALPHA) Select Case @error Return SetError(@error,0,0) Case $ret[0] = 0 Return SetError(4,0,0) Case Else Return 1 EndSelect EndFunc;==>_API_SetLayeredWindowAttributes Nice result, but to hard for me to take forward. So i think another approach. Group of GUI that can be assembled togheter and made hole where i want. So 'admin' can compose final layout, cover an application, save windows postion, to call when needed. Why this ? because i want to give a commercial application to my users, but only few option disposable and button to use. Made also simple script that made GUI that follow notepad and hide it to user: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> dim $old_x = 0, $old_y = 0, $old_width = 0, $old_height = 0 while 1 $size = WinGetPos("Senza nome - Blocco note") _follow_me() sleep(500) WEnd Func _follow_me() if $old_x <> $size[0] or $old_y <> $size[1] or $old_width <> $size[2] or $old_height <> $size[3] then GUISetState(@SW_HIDE) ;~ WinMove("Senza nome - Blocco note", "", $size[0], $size[0], $size[0], $size[0]) $gui = GUICreate("Background", $size[2], $size[3] - 50, $size[0], $size[1] + 25) GUISetState(@SW_SHOW) WinSetOnTop("Background", "", 1) $old_x = $size[0] $old_y = $size[1] $old_width = $size[2] $old_height = $size[3] endif EndFunc Imagine that this GUI is composed by more small gui resized ad hoc to cover part of application. Long description, stupid request and boring reading. Think is possible/usefull to script ? thank you, m. Edited January 16, 2009 by myspacee 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