martin Posted December 26, 2007 Share Posted December 26, 2007 (edited) No doubt it's been done before, but a post by MsCreatoR made me think of trying this.expandcollapse popup#include <GuiConstants.au3> HotKeySet("{ESC}", "QuitApp") $main_Gui = GUICreate("",400,400,20,20,$WS_POPUP, $WS_EX_TOOLWINDOW+$WS_EX_TOPMOST) $but1 = GUICtrlCreateButton(" Exit ", 100, 100,80,21) $Info_Edit = GUICtrlCreateEdit("A few words to start off with", 80, 150, 300, 220) $masterMask = CreateMasterMask(); AddToMask($masterMask,$main_Gui,$but1);add button to mask AddToMask($masterMask,$main_Gui,$Info_Edit);add the edit FitMask($masterMask,$main_gui);apply the mask to the window GUISetState() While 1 if GUIGetMsg() = $but1 then exit WEnd Func CreateMasterMask() return DllCall("gdi32.dll", "long", "CreateRectRgn", "long", 0, "long", 0, "long", 0, "long", 0) EndFunc Func FitMask($aMask,$hWnd) DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $hWnd, "long", $aMask[0], "int", 1) endfunc Func AddToMask(ByRef $MM, $hWnd, $ID) $pp = ControlGetPos($hWnd,'',$ID) Local $Mask1 = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", $pp[0], "long", $pp[1], "long", $pp[0] + $pp[2], "long",$pp[1] + $pp[3]) DllCall("gdi32.dll", "long", "CombineRgn", "long", $MM[0], "long", $Mask1[0], "long", $MM[0],"int",2) EndFunc Func QuitApp() Exit EndFuncEDIT: But talk of the devil, see next post for a better solution. Edited December 27, 2007 by martin 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. Link to comment Share on other sites More sharing options...
MrCreatoR Posted December 27, 2007 Share Posted December 27, 2007 (edited) Nice, once i looked for such functionality - thanks Here is a little improved(?) version, you do not need to set mask for each control manualy, specialy for this i wrote function _WinGetClassListEx() (it took my almoust an hour to figure it out) - so the control's classes will be numerated...expandcollapse popup#include <GuiConstants.au3> HotKeySet("{ESC}", "QuitApp") $Main_Gui = GUICreate("", 400, 400, 20, 20, $WS_POPUP, $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST) $But1 = GUICtrlCreateButton(" Exit ", 100, 100, 80, 21) $Info_Edit = GUICtrlCreateEdit("A few words to start off with", 80, 150, 300, 220) GUISetControlsVisible($Main_Gui) GUISetState() While 1 If GUIGetMsg() = $But1 Then Exit WEnd Func GUISetControlsVisible($hWnd) Local $aClassList, $aM_Mask, $aCtrlPos, $aMask $aClassList = StringSplit(_WinGetClassListEx($hWnd), @LF) $aM_Mask = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", 0, "long", 0, "long", 0, "long", 0) For $i = 1 To UBound($aClassList) - 1 $aCtrlPos = ControlGetPos($hWnd, '', $aClassList[$i]) If Not IsArray($aCtrlPos) Then ContinueLoop $aMask = DllCall("gdi32.dll", "long", "CreateRectRgn", _ "long", $aCtrlPos[0], _ "long", $aCtrlPos[1], _ "long", $aCtrlPos[0] + $aCtrlPos[2], _ "long", $aCtrlPos[1] + $aCtrlPos[3]) DllCall("gdi32.dll", "long", "CombineRgn", "long", $aM_Mask[0], "long", $aMask[0], "long", $aM_Mask[0], "int", 2) Next DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $hWnd, "long", $aM_Mask[0], "int", 1) EndFunc Func _WinGetClassListEx($sTitle) Local $sClassList = WinGetClassList($sTitle) Local $aClassList = StringSplit($sClassList, @LF) Local $sRetClassList = "", $sHold_List = "|" Local $aiInHold, $iInHold For $i = 1 To UBound($aClassList) - 1 If $aClassList[$i] = "" Then ContinueLoop If StringRegExp($sHold_List, "\|" & $aClassList[$i] & "~(\d+)\|") Then $aiInHold = StringRegExp($sHold_List, ".*\|" & $aClassList[$i] & "~(\d+)\|.*", 1) $iInHold = Number($aiInHold[UBound($aiInHold)-1]) If $iInHold = 0 Then $iInHold += 1 $aClassList[$i] &= "~" & $iInHold + 1 $sHold_List &= $aClassList[$i] & "|" $sRetClassList &= $aClassList[$i] & @LF Else $aClassList[$i] &= "~1" $sHold_List &= $aClassList[$i] & "|" $sRetClassList &= $aClassList[$i] & @LF EndIf Next Return StringReplace(StringStripWS($sRetClassList, 3), "~", "") EndFunc Func QuitApp() Exit EndFuncNot tested for external apps, but i think it could work.. also i think the func name not so perfect Edit: Localized few variables. Edited December 27, 2007 by MsCreatoR Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
martin Posted December 27, 2007 Author Share Posted December 27, 2007 Nice, once i looked for such functionality - thanks Here is a little improved(?) version, you do not need to set mask for each control manualy, specialy for this i wrote function _WinGetClassListEx() (it took my almoust an hour to figure it out) - so the control's classes will be numerated... expandcollapse popup#include <GuiConstants.au3> HotKeySet("{ESC}", "QuitApp") $Main_Gui = GUICreate("", 400, 400, 20, 20, $WS_POPUP, $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST) $But1 = GUICtrlCreateButton(" Exit ", 100, 100, 80, 21) $Info_Edit = GUICtrlCreateEdit("A few words to start off with", 80, 150, 300, 220) GUISetControlsVisible($Main_Gui) GUISetState() While 1 If GUIGetMsg() = $But1 Then Exit WEnd Func GUISetControlsVisible($hWnd) Local $aClassList, $aM_Mask, $aCtrlPos, $aMask $aClassList = StringSplit(_WinGetClassListEx($hWnd), @LF) $aM_Mask = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", 0, "long", 0, "long", 0, "long", 0) For $i = 1 To UBound($aClassList) - 1 $aCtrlPos = ControlGetPos($hWnd, '', $aClassList[$i]) If Not IsArray($aCtrlPos) Then ContinueLoop $aMask = DllCall("gdi32.dll", "long", "CreateRectRgn", _ "long", $aCtrlPos[0], _ "long", $aCtrlPos[1], _ "long", $aCtrlPos[0] + $aCtrlPos[2], _ "long", $aCtrlPos[1] + $aCtrlPos[3]) DllCall("gdi32.dll", "long", "CombineRgn", "long", $aM_Mask[0], "long", $aMask[0], "long", $aM_Mask[0], "int", 2) Next DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $hWnd, "long", $aM_Mask[0], "int", 1) EndFunc Func _WinGetClassListEx($sTitle) Local $sClassList = WinGetClassList($sTitle) Local $aClassList = StringSplit($sClassList, @LF) Local $sRetClassList = "", $sHold_List = "|" Local $aiInHold, $iInHold For $i = 1 To UBound($aClassList) - 1 If $aClassList[$i] = "" Then ContinueLoop If StringRegExp($sHold_List, "\|" & $aClassList[$i] & "~(\d+)\|") Then $aiInHold = StringRegExp($sHold_List, ".*\|" & $aClassList[$i] & "~(\d)+\|.*", 1) $iInHold = Number($aiInHold[UBound($aiInHold)-1]) If $iInHold = 0 Then $iInHold += 1 $aClassList[$i] &= "~" & $iInHold + 1 $sHold_List &= $aClassList[$i] & "|" $sRetClassList &= $aClassList[$i] & @LF Else $aClassList[$i] &= "~1" $sHold_List &= $aClassList[$i] & "|" $sRetClassList &= $aClassList[$i] & @LF EndIf Next Return StringReplace(StringStripWS($sRetClassList, 3), "~", "") EndFunc Func QuitApp() Exit EndFunc Not tested for external apps, but i think it could work.. also i think the func name not so perfect Edit: Localized few variables. That's a much better idea. I have never needed to do this but if I do I will use your method. 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. Link to comment Share on other sites More sharing options...
MrCreatoR Posted December 27, 2007 Share Posted December 27, 2007 (edited) Light version :#include <GuiConstants.au3> $Main_Gui = GUICreate("", 400, 400, 20, 20, $WS_POPUP, $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST) $But1 = GUICtrlCreateButton(" Exit ", 100, 100, 80, 21) $Info_Edit = GUICtrlCreateEdit("A few words to start off with", 80, 150, 300, 220) GUISetControlsVisible($Main_Gui) GUISetState() While 1 If GUIGetMsg() = $But1 Then Exit WEnd Func GUISetControlsVisible($hWnd) Local $aM_Mask, $aCtrlPos, $aMask $aM_Mask = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", 0, "long", 0, "long", 0, "long", 0) $aLastID = DllCall("user32.dll", "int", "GetDlgCtrlID", "hwnd", GUICtrlGetHandle(-1)) For $i = 3 To $aLastID[0] $aCtrlPos = ControlGetPos($hWnd, '', $i) If Not IsArray($aCtrlPos) Then ContinueLoop $aMask = DllCall("gdi32.dll", "long", "CreateRectRgn", _ "long", $aCtrlPos[0], _ "long", $aCtrlPos[1], _ "long", $aCtrlPos[0] + $aCtrlPos[2], _ "long", $aCtrlPos[1] + $aCtrlPos[3]) DllCall("gdi32.dll", "long", "CombineRgn", "long", $aM_Mask[0], "long", $aMask[0], "long", $aM_Mask[0], "int", 2) Next DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $hWnd, "long", $aM_Mask[0], "int", 1) EndFuncThis one definitely will not work on external apps, due to GUICtrlGetHandle(-1) - i realy don't know how else to get last control id in the window.P.SI think we need @LastID macro - at least for AutoIt GUIs this will be easier.=================================And here is the version for external apps, works for me lika a charm ...expandcollapse popup#include <GuiConstants.au3> HotKeySet("{ESC}", "QuitApp") $Main_Gui = GUICreate("", 400, 400);, -1, -1, $WS_POPUP, $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST) $But1 = GUICtrlCreateButton(" Exit ", 100, 100, 80, 21) $Info_Edit = GUICtrlCreateEdit("A few words to start off with", 80, 150, 300, 220) GUISetControlsVisible($Main_Gui) GUISetState() While 1 If GUIGetMsg() = $But1 Then Exit WEnd Func GUISetControlsVisible($hWnd) Local $aClassList, $aM_Mask, $aCtrlPos, $aMask ;Set $WS_POPUP style part: Local Const $GWL_STYLE = -16 Local Const $GWL_EXSTYLE = -20 Local Const $SWP_NOMOVE = 0x2 Local Const $SWP_NOSIZE = 0x1 Local Const $SWP_SHOWWINDOW = 0x40 Local Const $SWP_NOZORDER = 0x4 Local $iFlags = BitOR($SWP_SHOWWINDOW, $SWP_NOSIZE, $SWP_NOMOVE, $SWP_NOZORDER) DllCall("User32.dll", "int", "SetWindowLong", "hwnd", $hWnd, "int", $GWL_STYLE, "int", $WS_POPUP) DllCall("User32.dll", "int", "SetWindowPos", "hwnd", $hWnd, "hwnd", 0, "int", 0, "int", 0, "int", 0, "int", 0, "int", $iFlags) ;End Set $WS_POPUP style part $aClassList = StringSplit(_WinGetClassListEx($hWnd), @LF) $aM_Mask = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", 0, "long", 0, "long", 0, "long", 0) For $i = 1 To UBound($aClassList) - 1 $aCtrlPos = ControlGetPos($hWnd, '', $aClassList[$i]) If Not IsArray($aCtrlPos) Then ContinueLoop $aMask = DllCall("gdi32.dll", "long", "CreateRectRgn", _ "long", $aCtrlPos[0], _ "long", $aCtrlPos[1], _ "long", $aCtrlPos[0] + $aCtrlPos[2], _ "long", $aCtrlPos[1] + $aCtrlPos[3]) DllCall("gdi32.dll", "long", "CombineRgn", "long", $aM_Mask[0], "long", $aMask[0], "long", $aM_Mask[0], "int", 2) Next DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $hWnd, "long", $aM_Mask[0], "int", 1) EndFunc Func _WinGetClassListEx($sTitle) Local $sClassList = WinGetClassList($sTitle) Local $aClassList = StringSplit($sClassList, @LF) Local $sRetClassList = "", $sHold_List = "|" Local $aiInHold, $iInHold For $i = 1 To UBound($aClassList) - 1 If $aClassList[$i] = "" Then ContinueLoop If StringRegExp($sHold_List, "\|" & $aClassList[$i] & "~(\d+)\|") Then $aiInHold = StringRegExp($sHold_List, ".*\|" & $aClassList[$i] & "~(\d+)\|.*", 1) $iInHold = Number($aiInHold[UBound($aiInHold)-1]) If $iInHold = 0 Then $iInHold += 1 $aClassList[$i] &= "~" & $iInHold + 1 $sHold_List &= $aClassList[$i] & "|" $sRetClassList &= $aClassList[$i] & @LF Else $aClassList[$i] &= "~1" $sHold_List &= $aClassList[$i] & "|" $sRetClassList &= $aClassList[$i] & @LF EndIf Next Return StringReplace(StringStripWS($sRetClassList, 3), "~", "") EndFunc Func QuitApp() Exit EndFuncEdit: Added version for external apps, no need to set styles for our GUI. Edited December 27, 2007 by MsCreatoR Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
martin Posted December 27, 2007 Author Share Posted December 27, 2007 Light version : #include <GuiConstants.au3> $Main_Gui = GUICreate("", 400, 400, 20, 20, $WS_POPUP, $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST) $But1 = GUICtrlCreateButton(" Exit ", 100, 100, 80, 21) $Info_Edit = GUICtrlCreateEdit("A few words to start off with", 80, 150, 300, 220) GUISetControlsVisible($Main_Gui) GUISetState() While 1 If GUIGetMsg() = $But1 Then Exit WEnd Func GUISetControlsVisible($hWnd) Local $aM_Mask, $aCtrlPos, $aMask $aM_Mask = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", 0, "long", 0, "long", 0, "long", 0) $aLastID = DllCall("user32.dll", "int", "GetDlgCtrlID", "hwnd", GUICtrlGetHandle(-1)) For $i = 3 To $aLastID[0] $aCtrlPos = ControlGetPos($hWnd, '', $i) If Not IsArray($aCtrlPos) Then ContinueLoop $aMask = DllCall("gdi32.dll", "long", "CreateRectRgn", _ "long", $aCtrlPos[0], _ "long", $aCtrlPos[1], _ "long", $aCtrlPos[0] + $aCtrlPos[2], _ "long", $aCtrlPos[1] + $aCtrlPos[3]) DllCall("gdi32.dll", "long", "CombineRgn", "long", $aM_Mask[0], "long", $aMask[0], "long", $aM_Mask[0], "int", 2) Next DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $hWnd, "long", $aM_Mask[0], "int", 1) EndFunc This one definitely will not work on external apps, due to GUICtrlGetHandle(-1) - i realy don't know how else to get last control id in the window. P.S I think we need @LastID macro - at least for AutoIt GUIs this will be easier. ================================= And here is the version for external apps, works for me lika a charm ... expandcollapse popup#include <GuiConstants.au3> HotKeySet("{ESC}", "QuitApp") $Main_Gui = GUICreate("", 400, 400);, -1, -1, $WS_POPUP, $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST) $But1 = GUICtrlCreateButton(" Exit ", 100, 100, 80, 21) $Info_Edit = GUICtrlCreateEdit("A few words to start off with", 80, 150, 300, 220) GUISetControlsVisible($Main_Gui) GUISetState() While 1 If GUIGetMsg() = $But1 Then Exit WEnd Func GUISetControlsVisible($hWnd) Local $aClassList, $aM_Mask, $aCtrlPos, $aMask ;Set $WS_POPUP style part: Local Const $GWL_STYLE = -16 Local Const $GWL_EXSTYLE = -20 Local Const $SWP_NOMOVE = 0x2 Local Const $SWP_NOSIZE = 0x1 Local Const $SWP_SHOWWINDOW = 0x40 Local Const $SWP_NOZORDER = 0x4 Local $iFlags = BitOR($SWP_SHOWWINDOW, $SWP_NOSIZE, $SWP_NOMOVE, $SWP_NOZORDER) DllCall("User32.dll", "int", "SetWindowLong", "hwnd", $hWnd, "int", $GWL_STYLE, "int", $WS_POPUP) DllCall("User32.dll", "int", "SetWindowPos", "hwnd", $hWnd, "hwnd", 0, "int", 0, "int", 0, "int", 0, "int", 0, "int", $iFlags) ;End Set $WS_POPUP style part $aClassList = StringSplit(_WinGetClassListEx($hWnd), @LF) $aM_Mask = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", 0, "long", 0, "long", 0, "long", 0) For $i = 1 To UBound($aClassList) - 1 $aCtrlPos = ControlGetPos($hWnd, '', $aClassList[$i]) If Not IsArray($aCtrlPos) Then ContinueLoop $aMask = DllCall("gdi32.dll", "long", "CreateRectRgn", _ "long", $aCtrlPos[0], _ "long", $aCtrlPos[1], _ "long", $aCtrlPos[0] + $aCtrlPos[2], _ "long", $aCtrlPos[1] + $aCtrlPos[3]) DllCall("gdi32.dll", "long", "CombineRgn", "long", $aM_Mask[0], "long", $aMask[0], "long", $aM_Mask[0], "int", 2) Next DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $hWnd, "long", $aM_Mask[0], "int", 1) EndFunc Func _WinGetClassListEx($sTitle) Local $sClassList = WinGetClassList($sTitle) Local $aClassList = StringSplit($sClassList, @LF) Local $sRetClassList = "", $sHold_List = "|" Local $aiInHold, $iInHold For $i = 1 To UBound($aClassList) - 1 If $aClassList[$i] = "" Then ContinueLoop If StringRegExp($sHold_List, "\|" & $aClassList[$i] & "~(\d+)\|") Then $aiInHold = StringRegExp($sHold_List, ".*\|" & $aClassList[$i] & "~(\d+)\|.*", 1) $iInHold = Number($aiInHold[UBound($aiInHold)-1]) If $iInHold = 0 Then $iInHold += 1 $aClassList[$i] &= "~" & $iInHold + 1 $sHold_List &= $aClassList[$i] & "|" $sRetClassList &= $aClassList[$i] & @LF Else $aClassList[$i] &= "~1" $sHold_List &= $aClassList[$i] & "|" $sRetClassList &= $aClassList[$i] & @LF EndIf Next Return StringReplace(StringStripWS($sRetClassList, 3), "~", "") EndFunc Func QuitApp() Exit EndFunc Edit: Added version for external apps, no need to set styles for our GUI. I think that maybe we should declare $aM_mask as global because if it is declared in the function it will possibly be destroyed when the function exits. From MSDN After a successful call to SetWindowRgn, the system owns the region specified by the region handle hRgn. The system does not make a copy of the region. Thus, you should not make any further function calls with this region handle. In particular, do not delete this region handle. The system deletes the region handle when it no longer needed. 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. Link to comment Share on other sites More sharing options...
James Posted December 27, 2007 Share Posted December 27, 2007 What about mild transparency? I tried to do it, but got no where. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
martin Posted December 27, 2007 Author Share Posted December 27, 2007 (edited) What about mild transparency? I tried to do it, but got no where.Do you mean like this? expandcollapse popup#include <GuiConstants.au3> HotKeySet("{ESC}", "QuitApp") $BG = GUICreate("back windoww",400,400,0,0) ;WinSetTrans("back window","",0) $Main_Gui = GUICreate("", 400, 400,0,0, $WS_POPUP, $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST) $But1 = GUICtrlCreateButton(" Exit ", 100, 100, 80, 21) $Info_Edit = GUICtrlCreateEdit("A few words to start off with", 80, 150, 300, 220) GUISetControlsVisible($Main_Gui) $wp = WinGetPos(WinGetHandle("Untitled")) GUISetState(@SW_SHOW,$BG) GUISetState(@SW_SHOW,$Main_Gui) GUIRegisterMsg($WM_ACTIVATE, "WM_ACTIVATE") GUIRegisterMsg($WM_MOVE, "WM_MOVE") GUISwitch($BG) $n = 100 $way = 1 While 1 $Msg = GUIGetMsg() if $Msg = $But1 Then Exitloop WinSetTrans("back window","",$n) ;WinSetTrans($Main_Gui,"",$n);<--------choose this line instead of one above to make the components fade rather than the window if $n > 253 or $n < 40 then $way *= -1 Sleep(20);<-------------------------adjust for speed of fade $n += $way WEnd Func GUISetControlsVisible($hWnd) Local $aClassList, $aM_Mask, $aCtrlPos, $aMask ;Set $WS_POPUP style part: Local Const $GWL_STYLE = -16 Local Const $GWL_EXSTYLE = -20 Local Const $SWP_NOMOVE = 0x2 Local Const $SWP_NOSIZE = 0x1 Local Const $SWP_SHOWWINDOW = 0x40 Local Const $SWP_NOZORDER = 0x4 Local $iFlags = BitOR($SWP_SHOWWINDOW, $SWP_NOSIZE, $SWP_NOMOVE, $SWP_NOZORDER) DllCall("User32.dll", "int", "SetWindowLong", "hwnd", $hWnd, "int", $GWL_STYLE, "int", $WS_POPUP) DllCall("User32.dll", "int", "SetWindowPos", "hwnd", $hWnd, "hwnd", 0, "int", 0, "int", 0, "int", 0, "int", 0, "int", $iFlags) ;End Set $WS_POPUP style part $aClassList = StringSplit(_WinGetClassListEx($hWnd), @LF) $aM_Mask = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", 0, "long", 0, "long", 0, "long", 0) For $i = 1 To UBound($aClassList) - 1 $aCtrlPos = ControlGetPos($hWnd, '', $aClassList[$i]) If Not IsArray($aCtrlPos) Then ContinueLoop $aMask = DllCall("gdi32.dll", "long", "CreateRectRgn", _ "long", $aCtrlPos[0], _ "long", $aCtrlPos[1], _ "long", $aCtrlPos[0] + $aCtrlPos[2], _ "long", $aCtrlPos[1] + $aCtrlPos[3]) DllCall("gdi32.dll", "long", "CombineRgn", "long", $aM_Mask[0], "long", $aMask[0], "long", $aM_Mask[0], "int", 2) Next DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $hWnd, "long", $aM_Mask[0], "int", 1) EndFunc Func _WinGetClassListEx($sTitle) Local $sClassList = WinGetClassList($sTitle) Local $aClassList = StringSplit($sClassList, @LF) Local $sRetClassList = "", $sHold_List = "|" Local $aiInHold, $iInHold For $i = 1 To UBound($aClassList) - 1 If $aClassList[$i] = "" Then ContinueLoop If StringRegExp($sHold_List, "\|" & $aClassList[$i] & "~(\d+)\|") Then $aiInHold = StringRegExp($sHold_List, ".*\|" & $aClassList[$i] & "~(\d+)\|.*", 1) $iInHold = Number($aiInHold[UBound($aiInHold)-1]) If $iInHold = 0 Then $iInHold += 1 $aClassList[$i] &= "~" & $iInHold + 1 $sHold_List &= $aClassList[$i] & "|" $sRetClassList &= $aClassList[$i] & @LF Else $aClassList[$i] &= "~1" $sHold_List &= $aClassList[$i] & "|" $sRetClassList &= $aClassList[$i] & @LF EndIf Next Return StringReplace(StringStripWS($sRetClassList, 3), "~", "") EndFunc Func QuitApp() Exit EndFunc Func WM_MOVE($hWndGUI) If $hWndGUI <> $BG Then Return $GUI_RUNDEFMSG Local $ParentPosArr = WinGetPos($hWndGUI) WinMove($Main_Gui, "", $ParentPosArr[0], $ParentPosArr[1]) EndFunc Func WM_ACTIVATE($hWndGUI) If $hWndGUI = $BG Then WinActivate($Main_Gui) EndFunc Edited December 27, 2007 by martin CodeTinkerer 1 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. Link to comment Share on other sites More sharing options...
corey822 Posted December 27, 2007 Share Posted December 27, 2007 ohhh not bad looks like its floating in mid air i like it cheers C.W C.Wnew rules:1.dont use plz in a post or title use please instead2.always use help file as it is now muchly over rated3. dont think where not watching u4.please wait 24 hours after last post ot bump XD i use to make that mistake Link to comment Share on other sites More sharing options...
James Posted December 27, 2007 Share Posted December 27, 2007 Exactly like that! Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
Maikelfield Posted May 12, 2008 Share Posted May 12, 2008 Hi, this script rocks. I´m trying to see a picture under those controls, but when I add my picture, I can't use the original controls (I can see them but the button or the edit box doesn´t work). Any idea? Thanks. Here is the code, I have added two new lines: CODE#include <GuiConstants.au3> HotKeySet("{ESC}", "QuitApp") $main_Gui = GUICreate("",400,400,20,20,$WS_POPUP, $WS_EX_TOOLWINDOW+$WS_EX_TOPMOST) $Pic1 = GUICtrlCreatePic("mypicture.jpg", 0, 0, 300, 350) $but1 = GUICtrlCreateButton(" Exit ", 100, 100,80,21) $Info_Edit = GUICtrlCreateEdit("A few words to start off with", 80, 150, 300, 220) $masterMask = CreateMasterMask(); AddToMask($masterMask,$main_Gui,$Pic1);add picture to mask AddToMask($masterMask,$main_Gui,$but1);add button to mask AddToMask($masterMask,$main_Gui,$Info_Edit);add the edit FitMask($masterMask,$main_gui);apply the mask to the window GUISetState() While 1 if GUIGetMsg() = $but1 then exit WEnd Func CreateMasterMask() return DllCall("gdi32.dll", "long", "CreateRectRgn", "long", 0, "long", 0, "long", 0, "long", 0) EndFunc Func FitMask($aMask,$hWnd) DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $hWnd, "long", $aMask[0], "int", 1) endfunc Func AddToMask(ByRef $MM, $hWnd, $ID) $pp = ControlGetPos($hWnd,'',$ID) Local $Mask1 = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", $pp[0], "long", $pp[1], "long", $pp[0] + $pp[2], "long",$pp[1] + $pp[3]) DllCall("gdi32.dll", "long", "CombineRgn", "long", $MM[0], "long", $Mask1[0], "long", $MM[0],"int",2) EndFunc Func QuitApp() Exit EndFunc Link to comment Share on other sites More sharing options...
d2addict4 Posted May 12, 2008 Share Posted May 12, 2008 (edited) I fixed up this function, so it will can be used without setting any styles for the GUI, requiring only one function, and also not having to include the GUIConstants.au3 file. expandcollapse popupFunc HideGUIDisplayCtrls($hWnd) GUISetStyle(0x80000000, 0x00000080+0x00000008, $hWnd) Local $sClassList = WinGetClassList($hWnd) Local $aClassList = StringSplit($sClassList, @LF) Local $sRetClassList = "", $sHold_List = "|" Local $aiInHold, $iInHold Local $aClassList, $aM_Mask, $aCtrlPos, $aMask For $i = 1 To UBound($aClassList) - 1 If $aClassList[$i] = "" Then ContinueLoop If StringRegExp($sHold_List, "\|" & $aClassList[$i] & "~(\d+)\|") Then $aiInHold = StringRegExp($sHold_List, ".*\|" & $aClassList[$i] & "~(\d)+\|.*", 1) $iInHold = Number($aiInHold[UBound($aiInHold)-1]) If $iInHold = 0 Then $iInHold += 1 $aClassList[$i] &= "~" & $iInHold + 1 $sHold_List &= $aClassList[$i] & "|" $sRetClassList &= $aClassList[$i] & @LF Else $aClassList[$i] &= "~1" $sHold_List &= $aClassList[$i] & "|" $sRetClassList &= $aClassList[$i] & @LF EndIf Next Local $Info = StringReplace(StringStripWS($sRetClassList, 3), "~", "") $aClassList = StringSplit($Info, @LF) $aM_Mask = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", 0, "long", 0, "long", 0, "long", 0) For $i = 1 To UBound($aClassList) - 1 $aCtrlPos = ControlGetPos($hWnd, '', $aClassList[$i]) If Not IsArray($aCtrlPos) Then ContinueLoop $aMask = DllCall("gdi32.dll", "long", "CreateRectRgn", _ "long", $aCtrlPos[0], _ "long", $aCtrlPos[1], _ "long", $aCtrlPos[0] + $aCtrlPos[2], _ "long", $aCtrlPos[1] + $aCtrlPos[3]) DllCall("gdi32.dll", "long", "CombineRgn", "long", $aM_Mask[0], "long", $aMask[0], "long", $aM_Mask[0], "int", 2) Next DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $hWnd, "long", $aM_Mask[0], "int", 1) EndFunc Edited May 12, 2008 by d2addict4 Simple AutoIt Point Of Sale Link to comment Share on other sites More sharing options...
MrCreatoR Posted May 12, 2008 Share Posted May 12, 2008 I fixed up this function, so it will can be used without setting any styles for the GUI, requiring only one function, and also not having to include the GUIConstants.au3 file......Not a good idea (for modification reasons) Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
Maikelfield Posted May 12, 2008 Share Posted May 12, 2008 Hi, this script rocks. I´m trying to see a picture under those controls, but when I add my picture, I can't use the original controls (I can see them but the button or the edit box doesn´t work). Any idea? Thanks. Here is the code, I have added two new lines: CODE#include <GuiConstants.au3> HotKeySet("{ESC}", "QuitApp") $main_Gui = GUICreate("",400,400,20,20,$WS_POPUP, $WS_EX_TOOLWINDOW+$WS_EX_TOPMOST) $Pic1 = GUICtrlCreatePic("mypicture.jpg", 0, 0, 300, 350) $but1 = GUICtrlCreateButton(" Exit ", 100, 100,80,21) $Info_Edit = GUICtrlCreateEdit("A few words to start off with", 80, 150, 300, 220) $masterMask = CreateMasterMask(); AddToMask($masterMask,$main_Gui,$Pic1);add picture to mask AddToMask($masterMask,$main_Gui,$but1);add button to mask AddToMask($masterMask,$main_Gui,$Info_Edit);add the edit FitMask($masterMask,$main_gui);apply the mask to the window GUISetState() While 1 if GUIGetMsg() = $but1 then exit WEnd Func CreateMasterMask() return DllCall("gdi32.dll", "long", "CreateRectRgn", "long", 0, "long", 0, "long", 0, "long", 0) EndFunc Func FitMask($aMask,$hWnd) DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $hWnd, "long", $aMask[0], "int", 1) endfunc Func AddToMask(ByRef $MM, $hWnd, $ID) $pp = ControlGetPos($hWnd,'',$ID) Local $Mask1 = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", $pp[0], "long", $pp[1], "long", $pp[0] + $pp[2], "long",$pp[1] + $pp[3]) DllCall("gdi32.dll", "long", "CombineRgn", "long", $MM[0], "long", $Mask1[0], "long", $MM[0],"int",2) EndFunc Func QuitApp() Exit EndFunc Opssss, solved, my problem was that I forgot to put "GuiCtrlSetState( -1, $GUI_DISABLE)" after creating the picture. Now the controls work. Sorry I´m a noob. Link to comment Share on other sites More sharing options...
martin Posted May 12, 2008 Author Share Posted May 12, 2008 Hi, this script rocks. I´m trying to see a picture under those controls, but when I add my picture, I can't use the original controls (I can see them but the button or the edit box doesn´t work). Any idea? Thanks. Here is the code, I have added two new lines: CODE#include <GuiConstants.au3> HotKeySet("{ESC}", "QuitApp") $main_Gui = GUICreate("",400,400,20,20,$WS_POPUP, $WS_EX_TOOLWINDOW+$WS_EX_TOPMOST) $Pic1 = GUICtrlCreatePic("mypicture.jpg", 0, 0, 300, 350) $but1 = GUICtrlCreateButton(" Exit ", 100, 100,80,21) $Info_Edit = GUICtrlCreateEdit("A few words to start off with", 80, 150, 300, 220) $masterMask = CreateMasterMask(); AddToMask($masterMask,$main_Gui,$Pic1);add picture to mask AddToMask($masterMask,$main_Gui,$but1);add button to mask AddToMask($masterMask,$main_Gui,$Info_Edit);add the edit FitMask($masterMask,$main_gui);apply the mask to the window GUISetState() While 1 if GUIGetMsg() = $but1 then exit WEnd Func CreateMasterMask() return DllCall("gdi32.dll", "long", "CreateRectRgn", "long", 0, "long", 0, "long", 0, "long", 0) EndFunc Func FitMask($aMask,$hWnd) DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $hWnd, "long", $aMask[0], "int", 1) endfunc Func AddToMask(ByRef $MM, $hWnd, $ID) $pp = ControlGetPos($hWnd,'',$ID) Local $Mask1 = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", $pp[0], "long", $pp[1], "long", $pp[0] + $pp[2], "long",$pp[1] + $pp[3]) DllCall("gdi32.dll", "long", "CombineRgn", "long", $MM[0], "long", $Mask1[0], "long", $MM[0],"int",2) EndFunc Func QuitApp() Exit EndFuncThis is a common problem. You need to disable th epic GUICtrlSetState($Pic1,$GUI_DISABLE) 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. Link to comment Share on other sites More sharing options...
BigDaddyO Posted October 9, 2008 Share Posted October 9, 2008 (edited) This is almost perfect, Except... Using the lite version I have a GUI that is invisible except for a logo and a label below that. I am trying to add the label with a transparent background so you only see the text. Any ideas? Thanks, Mike My Script expandcollapse popup#include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> $Main_Gui = GUICreate("", 187, 200, 20, 20, $WS_POPUP, $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST + $GUI_BKCOLOR_TRANSPARENT) GUICtrlCreatePic("logo.jpg", 0, 0, 0, 0) GUISetBkColor(0xE0FFFF, $Main_Gui) $But1 = GUICtrlCreateButton(" Exit ", 100, 140, 80, 21) $hStatus = GUICtrlCreateLabel("Please wait, Extracting Files.....", 0, 90, 187, 20, $SS_CENTER, $WS_EX_TRANSPARENT) GUICtrlSetBkColor($hStatus, $GUI_BKCOLOR_TRANSPARENT) GUISetControlsVisible($Main_Gui) GUISetState() While 1 If GUIGetMsg() = $But1 Then Exit WEnd Func GUISetControlsVisible($hWnd) Local $aM_Mask, $aCtrlPos, $aMask $aM_Mask = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", 0, "long", 0, "long", 0, "long", 0) $aLastID = DllCall("user32.dll", "int", "GetDlgCtrlID", "hwnd", GUICtrlGetHandle(-1)) For $i = 3 To $aLastID[0] $aCtrlPos = ControlGetPos($hWnd, '', $i) If Not IsArray($aCtrlPos) Then ContinueLoop $aMask = DllCall("gdi32.dll", "long", "CreateRectRgn", _ "long", $aCtrlPos[0], _ "long", $aCtrlPos[1], _ "long", $aCtrlPos[0] + $aCtrlPos[2], _ "long", $aCtrlPos[1] + $aCtrlPos[3]) DllCall("gdi32.dll", "long", "CombineRgn", "long", $aM_Mask[0], "long", $aMask[0], "long", $aM_Mask[0], "int", 2) Next DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $hWnd, "long", $aM_Mask[0], "int", 1) EndFunc Edited October 9, 2008 by MikeOsdx Link to comment Share on other sites More sharing options...
ProgAndy Posted October 9, 2008 Share Posted October 9, 2008 Just look at this: http://www.autoitscript.com/forum/index.php?showtopic=74560-> This sets a certain color to be transparent. Everything else is shown. *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
martin Posted October 9, 2008 Author Share Posted October 9, 2008 Just look at this: http://www.autoitscript.com/forum/index.php?showtopic=74560-> This sets a certain color to be transparent. Everything else is shown.Yes it's true that is the easiest way, but you have to make sure the transparent colour isn't found in some picture or a graphic or you get holes where you don't want them. Also, you have to use $WS_POPUP with the style $WS_LAYERED if you don't want to see the window borders or caption, and I think that is a problem for child windows.So I suppose, 97% of the time you are right 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. Link to comment Share on other sites More sharing options...
BigDaddyO Posted October 9, 2008 Share Posted October 9, 2008 That worked, thanks Link to comment Share on other sites More sharing options...
Thornhunt Posted June 8, 2010 Share Posted June 8, 2010 Brilliant. what about moving the mask ? likewise the edit box would move with the gui when its moved, is it possible to move the mask around the desktop ? Budweiser + room = warm beerwarm beer + fridge = too long!warm beer + CO2 fire extinguisher = Perfect![quote]Protect the easly offended ... BAN EVERYTHING[/quote]^^ hmm works for me :D Link to comment Share on other sites More sharing options...
picea892 Posted June 8, 2010 Share Posted June 8, 2010 Brilliant. what about moving the mask ? likewise the edit box would move with the gui when its moved, is it possible to move the mask around the desktop ? Have you tried it? Perhaps this link will help. Otherwise, perhaps this example. expandcollapse popup#include <GuiConstants.au3> $my_gui = GUICreate("MyGUI", 400, 400) Global $x=100, $y=100,$radius=100 _GuiHole($my_gui, $x, $y, $radius) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case Else ;;; EndSelect sleep(100) $x=Random(-40,40)+$x $y=Random(-40,40)+$y $radius=Random(-20,20)+$radius if $x<0 then $x=0 if $x>400 then $x=350 if $y<0 then $y=0 if $y>400 then $y=350 if $radius<0 then $radius=0 _GuiHole($my_gui, $x, $y, $radius) WEnd Exit Func _GuiHole($h_win, $i_x, $i_y, $i_size) Dim $pos, $outer_rgn, $inner_rgn, $wh, $combined_rgn, $ret $pos = WinGetPos($h_win) $outer_rgn = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", 0, "long", 0, "long", $pos[2], "long", $pos[3]) If IsArray($outer_rgn) Then $inner_rgn = DllCall("gdi32.dll", "long", "CreateEllipticRgn", "long", $i_x, "long", $i_y, "long", $i_x + $i_size, "long", $i_y + $i_size) If IsArray($inner_rgn) Then $combined_rgn = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", 0, "long", 0, "long", 0, "long", 0) If IsArray($combined_rgn) Then DllCall("gdi32.dll", "long", "CombineRgn", "long", $combined_rgn[0], "long", $outer_rgn[0], "long", $inner_rgn[0], "int", 4) $ret = DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $combined_rgn[0], "int", 1) If $ret[0] Then Return 1 Else Return 0 EndIf Else Return 0 EndIf Else Return 0 EndIf Else Return 0 EndIf EndFunc ;==>_GuiHole 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