Jump to content

Is it possible to highlight controls in GUI like in AutoIT-Info


jlorenz1
 Share

Recommended Posts

With what Autoit-command can I highlight controls in my own GUI or of other applications? There should be only a thick black border to highlight it and it should give the user a feedback, if he has choosen the correct control. Give me the command or the syntax, if I can't find it in the help file. Thanks in advance Johannes

;for example it should highlight the control "Edit1" of notepad.exe, which a user has given his focus
Dim $sTitle="Untitled -"
Dim $iAbsPosControl[2]

Run("notepad.exe")
WinWait($sTitle)
ControlSetFocus($sTitle, "", "Edit1"); user has choosen Edit1

$sTitle = WinGetTitle("")   ; title of the active window
$sText = WinGetText($sTitle) 
$sControl  = ControlGetFocus($sTitle, $sText)   ; handle of the choosen control
$hControl = ControlGetHandle($sTitle, $sText, $sControl) 
$iPosWin = WinGetPos($sTitle, $sText)
$iPosControl = WinGetPos($sTitle, $sText, $hControl)
$iAbsPosControl[0] = $iPosWin[0] +  $iPosControl[0]
$iAbsPosControl[1] = $iPosWin[1] +  $iPosControl[1]

; and now??? a new transparent window with thick black border over the position of choosen control 
; -  OR does a solution exist with is more elegant?

Johannes LorenzBensheim, Germanyjlorenz1@web.de[post="12602"]Highlightning AutoIt Syntax in Notepad++ - Just copy in your Profile/application data/notepad++[/post]

Link to comment
Share on other sites

I can't actualy believe this, but i did it!!! Posted Image

Here we go:

#include <GuiConstants.au3>
Opt("GuiOnEventMode", 1)
HotKeySet("{ESC}", "QuitApp")

If Not IsDeclared("WM_WINDOWPOSCHANGED") Then Global Const $WM_WINDOWPOSCHANGED = 0x0047

Global $ahGUI[4]
Global $Last_hControl = -1

Global $Frame_Color = 0x0 ;0xFF0000
Global $Frame_Width = 2

$Main_GUI = GuiCreate("Highlight Controls Demo")
GUISetOnEvent($GUI_EVENT_CLOSE, "QuitApp")
GUIRegisterMsg($WM_WINDOWPOSCHANGED, "WM_WINDOWPOSCHANGED")

GUICtrlCreateButton("Button", 20, 20)
GUICtrlCreateCheckbox("CheckBox", 20, 60)
GUICtrlCreateEdit("", 120, 60, 240, 150)


GUICtrlCreateLabel("Info: ", 20, 250)
GUICtrlSetFont(-1, 9, 800)
$Info_Label = GUICtrlCreateLabel("", 120, 270, 250, 80)

GUISetState()

While 1
    Sleep(10)
    
    $hCtrl = _ControlGetHovered()
    
    If $hCtrl <> 0 And $Last_hControl <> $hCtrl And Not IsHighLight_GUIs($hCtrl) Then
        $Last_hControl = $hCtrl
        $aCtrlPos = WinGetPos($hCtrl)
        
        GUICtrlSetData($Info_Label, _
            "X = " & $aCtrlPos[0] & @CRLF & _
            "Y = " & $aCtrlPos[1] & @CRLF & _
            "W = " & $aCtrlPos[2] & @CRLF & _
            "H = " & $aCtrlPos[3] & @CRLF & _
            "Control Data = " & ControlGetText($hCtrl, "", ""))
        
        GUISquareDelete()
        GUICreateSquare($aCtrlPos[0], $aCtrlPos[1], $aCtrlPos[2], $aCtrlPos[3])
    EndIf
WEnd

Func GUICreateSquare($X, $Y, $W, $H)
    $ahGUI[0] = GUICreate("", $W, $Frame_Width, $X, $Y, $WS_POPUP, $WS_EX_TOPMOST+$WS_EX_TOOLWINDOW)
    GUISetBkColor($Frame_Color)
    
    $ahGUI[1] = GUICreate("", $Frame_Width, $H, $X, $Y, $WS_POPUP, $WS_EX_TOPMOST+$WS_EX_TOOLWINDOW)
    GUISetBkColor($Frame_Color)
    
    $ahGUI[2] = GUICreate("", $Frame_Width, $H, $X+$W, $Y, $WS_POPUP, $WS_EX_TOPMOST+$WS_EX_TOOLWINDOW)
    GUISetBkColor($Frame_Color)
    
    $ahGUI[3] = GUICreate("", $W+$Frame_Width, $Frame_Width, $X, $Y+$H, $WS_POPUP, $WS_EX_TOPMOST+$WS_EX_TOOLWINDOW)
    GUISetBkColor($Frame_Color)
    
    For $i = 0 To 3
        GUISetState(@SW_SHOW, $ahGUI[$i])
    Next
EndFunc

Func GUISquareDelete()
    For $i = 0 To 3
        If IsHWnd($ahGUI[$i]) And $ahGUI[$i] <> $Main_GUI Then GUIDelete($ahGUI[$i])
    Next
    
    $ahGUI = ""
    Dim $ahGUI[4]
EndFunc

Func IsHighLight_GUIs($hCtrl)
    For $i = 0 To 3
        If $ahGUI[$i] = $hCtrl Then Return True
    Next
    Return False
EndFunc

Func _ControlGetHovered()
    Local $aRet = DllCall("user32.dll", "int", "WindowFromPoint", "long", MouseGetPos(0), "long", MouseGetPos(1))
    If Not IsArray($aRet) Then Return SetError(1, 0, 0)
    Return HWnd($aRet[0])
EndFunc

Func WM_WINDOWPOSCHANGED($hWndGUI, $MsgID, $WParam, $LParam)
    If $hWndGUI <> $Main_GUI Then Return $GUI_RUNDEFMSG
    GUISquareDelete()
    $Last_hControl = -1
EndFunc

Func QuitApp()
    Exit
EndFunc

Edit: Fixed the issue with $Main_GUI movements.

Edited by MsCreatoR

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: 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 Program

AutoIt_Icon_small.pngUDFs: 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
 
AutoIt_Icon_small.pngExamples: 
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 AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

I can't actualy believe this, but i did it!!! Posted Image

Here we go:

#include <GuiConstants.au3>
Opt("GuiOnEventMode", 1)
HotKeySet("{ESC}", "QuitApp")

If Not IsDeclared("WM_WINDOWPOSCHANGED") Then Global Const $WM_WINDOWPOSCHANGED = 0x0047

Global $ahGUI[4]
Global $Last_hControl = -1

Global $Frame_Color = 0x0 ;0xFF0000
Global $Frame_Width = 2

$Main_GUI = GuiCreate("Highlight Controls Demo")
GUISetOnEvent($GUI_EVENT_CLOSE, "QuitApp")
GUIRegisterMsg($WM_WINDOWPOSCHANGED, "WM_WINDOWPOSCHANGED")

GUICtrlCreateButton("Button", 20, 20)
GUICtrlCreateCheckbox("CheckBox", 20, 60)
GUICtrlCreateEdit("", 120, 60, 240, 150)


GUICtrlCreateLabel("Info: ", 20, 250)
GUICtrlSetFont(-1, 9, 800)
$Info_Label = GUICtrlCreateLabel("", 120, 270, 250, 80)

GUISetState()

While 1
    Sleep(10)
    
    $hCtrl = _ControlGetHovered()
    
    If $hCtrl <> 0 And $Last_hControl <> $hCtrl And Not IsHighLight_GUIs($hCtrl) Then
        $Last_hControl = $hCtrl
        $aCtrlPos = WinGetPos($hCtrl)
        
        GUICtrlSetData($Info_Label, _
            "X = " & $aCtrlPos[0] & @CRLF & _
            "Y = " & $aCtrlPos[1] & @CRLF & _
            "W = " & $aCtrlPos[2] & @CRLF & _
            "H = " & $aCtrlPos[3] & @CRLF & _
            "Control Data = " & ControlGetText($hCtrl, "", ""))
        
        GUISquareDelete()
        GUICreateSquare($aCtrlPos[0], $aCtrlPos[1], $aCtrlPos[2], $aCtrlPos[3])
    EndIf
WEnd

Func GUICreateSquare($X, $Y, $W, $H)
    $ahGUI[0] = GUICreate("", $W, $Frame_Width, $X, $Y, $WS_POPUP, $WS_EX_TOPMOST+$WS_EX_TOOLWINDOW)
    GUISetBkColor($Frame_Color)
    
    $ahGUI[1] = GUICreate("", $Frame_Width, $H, $X, $Y, $WS_POPUP, $WS_EX_TOPMOST+$WS_EX_TOOLWINDOW)
    GUISetBkColor($Frame_Color)
    
    $ahGUI[2] = GUICreate("", $Frame_Width, $H, $X+$W, $Y, $WS_POPUP, $WS_EX_TOPMOST+$WS_EX_TOOLWINDOW)
    GUISetBkColor($Frame_Color)
    
    $ahGUI[3] = GUICreate("", $W+$Frame_Width, $Frame_Width, $X, $Y+$H, $WS_POPUP, $WS_EX_TOPMOST+$WS_EX_TOOLWINDOW)
    GUISetBkColor($Frame_Color)
    
    For $i = 0 To 3
        GUISetState(@SW_SHOW, $ahGUI[$i])
    Next
EndFunc

Func GUISquareDelete()
    For $i = 0 To 3
        If IsHWnd($ahGUI[$i]) And $ahGUI[$i] <> $Main_GUI Then GUIDelete($ahGUI[$i])
    Next
    
    $ahGUI = ""
    Dim $ahGUI[4]
EndFunc

Func IsHighLight_GUIs($hCtrl)
    For $i = 0 To 3
        If $ahGUI[$i] = $hCtrl Then Return True
    Next
    Return False
EndFunc

Func _ControlGetHovered()
    Local $aRet = DllCall("user32.dll", "int", "WindowFromPoint", "long", MouseGetPos(0), "long", MouseGetPos(1))
    If Not IsArray($aRet) Then Return SetError(1, 0, 0)
    Return HWnd($aRet[0])
EndFunc

Func WM_WINDOWPOSCHANGED($hWndGUI, $MsgID, $WParam, $LParam)
    If $hWndGUI <> $Main_GUI Then Return $GUI_RUNDEFMSG
    GUISquareDelete()
    $Last_hControl = -1
EndFunc

Func QuitApp()
    Exit
EndFunc

Edit: Fixed the issue with $Main_GUI movements.

Excellent MsCreatoR, it works!

Only one small point, this line

If Not IsDeclared("WM_WINDOWPOSCHANGED") Then Global Const $WM_WINDOWPOSCHANGED = 0x0047

doesn't work, you need to do this I think

If Not IsDeclared("WM_WINDOWPOSCHANGED") Then Assign("WM_WINDOWPOSCHANGED",0x0047)

EDIT: Also, I think the frame is a bit offset, so I added this

Func GUICreateSquare($X, $Y, $W, $H)
   $X -= $Frame_Width
   $Y -= $Frame_Width
   $W += $Frame_Width
   $H += $Frame_Width
Edited 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

I'm expected different solution, but this one work quite well!

If the window which is framed is moved then the frame stays in the original place. This version stops that

#include <GuiConstants.au3>
#include <misc.au3>
Opt("GuiOnEventMode", 1)
HotKeySet("{ESC}", "QuitApp")

If Not IsDeclared("WM_WINDOWPOSCHANGED") Then Assign("WM_WINDOWPOSCHANGED",0x0047)
Global $ahGUI[4]
Global $Last_hControl = -1

Global $Frame_Color = 0xff0000;0xFF0000
Global $Frame_Width = 2
Global $hCtrl
$Main_GUI = GuiCreate("Highlight Controls Demo")
GUISetOnEvent($GUI_EVENT_CLOSE, "QuitApp")
GUIRegisterMsg($WM_WINDOWPOSCHANGED, "WM_WINDOWPOSCHANGED")


GUICtrlCreateButton("Button", 20, 20)
GUICtrlCreateCheckbox("CheckBox", 20, 60)
GUICtrlCreateEdit("", 120, 60, 240, 150)


GUICtrlCreateLabel("Info: ", 20, 250)
GUICtrlSetFont(-1, 9, 800)
$Info_Label = GUICtrlCreateLabel("", 120, 270, 250, 80)

GUISetState()

While 1
    Sleep(100)

    $hCtrl = _ControlGetHovered()

    If $hCtrl <> 0 And $Last_hControl <> $hCtrl And Not IsHighLight_GUIs($hCtrl) Then
        if not _IsPressed("1") Then
            $Last_hControl = $hCtrl
            $aCtrlPos = WinGetPos($hCtrl)

            GUICtrlSetData($Info_Label, _
                    "X = " & $aCtrlPos[0] & @CRLF & _
                    "Y = " & $aCtrlPos[1] & @CRLF & _
                    "W = " & $aCtrlPos[2] & @CRLF & _
                    "H = " & $aCtrlPos[3] & @CRLF & _
                    "Control Data = " & ControlGetText($hCtrl, "", ""))

            GUISquareDelete()
            GUICreateSquare($aCtrlPos[0], $aCtrlPos[1], $aCtrlPos[2], $aCtrlPos[3])
        EndIf
    Else
        $aNewCtrlPos = WinGetPos($hCtrl)
        for $n = 0 to 3
            if $aCtrlPos[$n] <> $aNewCtrlPos[$n] Then
                GUISquareDelete()
                $hCtrl = 0
                $Last_hControl = 0
                ExitLoop
            EndIf
        Next
    EndIf
WEnd

Func GUICreateSquare($X, $Y, $W, $H)
    $X -= $Frame_Width
    $Y -= $Frame_Width
    $W += $Frame_Width
    $H += $Frame_Width
    $ahGUI[0] = GUICreate("", $W, $Frame_Width, $X, $Y, $WS_POPUP, $WS_EX_TOPMOST+$WS_EX_TOOLWINDOW)
    GUISetBkColor($Frame_Color)

    $ahGUI[1] = GUICreate("", $Frame_Width, $H, $X, $Y, $WS_POPUP, $WS_EX_TOPMOST+$WS_EX_TOOLWINDOW)
    GUISetBkColor($Frame_Color)

    $ahGUI[2] = GUICreate("", $Frame_Width, $H, $X+$W, $Y, $WS_POPUP, $WS_EX_TOPMOST+$WS_EX_TOOLWINDOW)
    GUISetBkColor($Frame_Color)

    $ahGUI[3] = GUICreate("", $W+$Frame_Width, $Frame_Width, $X, $Y+$H, $WS_POPUP, $WS_EX_TOPMOST+$WS_EX_TOOLWINDOW)
    GUISetBkColor($Frame_Color)

    For $i = 0 To 3
        GUISetState(@SW_SHOW, $ahGUI[$i])
    Next
EndFunc

Func GUISquareDelete()
    For $i = 0 To 3
        If IsHWnd($ahGUI[$i]) And $ahGUI[$i] <> $Main_GUI Then GUIDelete($ahGUI[$i])
    Next

    $ahGUI = ""
    Dim $ahGUI[4]
EndFunc

Func IsHighLight_GUIs($hCtrl)
    For $i = 0 To 3
        If $ahGUI[$i] = $hCtrl Then Return True
    Next
    Return False
EndFunc

Func _ControlGetHovered()
    Local $aRet = DllCall("user32.dll", "int", "WindowFromPoint", "long", MouseGetPos(0), "long", MouseGetPos(1))
    If Not IsArray($aRet) Then Return SetError(1, 0, 0)
    Return HWnd($aRet[0])
EndFunc


Func WM_WINDOWPOSCHANGED($hWndGUI, $MsgID, $WParam, $LParam)
    If $hWndGUI = $Main_GUI or $hWndGUI = $hCtrl Then
        GUISquareDelete()
        $Last_hControl = -1
    Else
        Return $GUI_RUNDEFMSG
    EndIf
EndFunc

Func QuitApp()
    Exit
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.
Link to comment
Share on other sites

Thanks it works fine, a little bit strange to use for each side of rectangle one GUI, but that is not important . Johannes

Johannes LorenzBensheim, Germanyjlorenz1@web.de[post="12602"]Highlightning AutoIt Syntax in Notepad++ - Just copy in your Profile/application data/notepad++[/post]

Link to comment
Share on other sites

doesn't work, you need to do this I think

It's work, it's just the syntax check probably not allows to use this since the variable already declared as constant.

I think the frame is a bit offset, so I added this

Yes it was, thanks...

I changed the example now, no need 4 GUIs anymore! i used Gui_Hole (i think by GaryFrost), and also i added _IdleWait() function, so the scipt will wait untill user do something.

The issue with windows movements is solved partialy, the part that i can not solve, is that when the window is behind another one, the frame is visible on top of that forground window, but maybe it's ok, maybe this how it should be (in Au3Info Tool the behaviour is different, the frame is hidden in the part where the toppest window are visible/on top)...

#include <GuiConstants.au3>
#include <Misc.au3>
Opt("GuiOnEventMode", 1)
HotKeySet("{ESC}", "QuitApp")

If Not IsDeclared("WM_WINDOWPOSCHANGED") Then Global Const $WM_WINDOWPOSCHANGED = 0x0047
;If Not IsDeclared("WM_WINDOWPOSCHANGED") Then Assign("WM_WINDOWPOSCHANGED", 0x0047)

Global $hSquare_GUI     = -1
Global $hCtrl           = -1
Global $Last_hControl   = -1

Global $Frame_Color     = 0xFF0000
Global $Frame_Width     = 3

$Main_GUI = GuiCreate("Highlight Controls Demo")
GUISetOnEvent($GUI_EVENT_CLOSE, "QuitApp")
GUIRegisterMsg($WM_WINDOWPOSCHANGED, "WM_WINDOWPOSCHANGED")

GUICtrlCreateButton("Button", 20, 20)
GUICtrlCreateCheckbox("CheckBox", 20, 60)


GUICtrlCreateLabel("Info: ", 20, 150)
GUICtrlSetFont(-1, 9, 800)
$Info_Edit = GUICtrlCreateEdit("", 80, 150, 300, 220, $GUI_SS_DEFAULT_EDIT+$ES_READONLY)

GUISetState()

While 1
    Sleep(10) ;So the CPU will not increes "badly" while we play with the mouse cursor :)
    _IdleWait()
    
    If _IsPressed(1) Then
        GUIDeleteSquare($hSquare_GUI)
        While _IsPressed(1)
            Sleep(10)
            Check_Highlight_Controls_Proc()
        WEnd
        $Last_hControl = -1
    EndIf
    
    Check_Highlight_Controls_Proc()
WEnd

Func Check_Highlight_Controls_Proc()
    Local $hCtrl = _ControlGetHovered()
    
    If $hCtrl <> 0 And $Last_hControl <> $hCtrl And $hSquare_GUI <> $hCtrl Then
        $Last_hControl = $hCtrl
        Local $aCtrlPos = WinGetPos($hCtrl)
        
        GUICtrlSetData($Info_Edit, _
            "X = " & $aCtrlPos[0] & @CRLF & _
            "Y = " & $aCtrlPos[1] & @CRLF & _
            "W = " & $aCtrlPos[2] & @CRLF & _
            "H = " & $aCtrlPos[3] & @CRLF & @CRLF & _
            "Control/Win Handle: " & $hCtrl & @CRLF & _
            "Control ID: " & _HwndToID($hCtrl) & @CRLF & @CRLF & _
            "Control Data:" & @CRLF & ControlGetText($hCtrl, "", ""))
        
        GUIDeleteSquare($hSquare_GUI)
        $hSquare_GUI = GUICreateSquare($aCtrlPos[0], $aCtrlPos[1], $aCtrlPos[2], $aCtrlPos[3])
    EndIf
EndFunc

Func GUICreateSquare($i_X=-1, $i_Y=-1, $i_W=-1, $i_H=-1)
    Local $hSquare_GUI = GUICreate("", $i_W, $i_H, $i_X, $i_Y, $WS_POPUP, $WS_EX_TOOLWINDOW+$WS_EX_TOPMOST)
    GUISetBkColor($Frame_Color)
    
    _GUISetHole($hSquare_GUI, $Frame_Width, $Frame_Width, $i_W - ($Frame_Width * 2), $i_H - ($Frame_Width * 2))
    
    GUISetState(@SW_SHOWNOACTIVATE, $hSquare_GUI)
    
    Return $hSquare_GUI
EndFunc

Func GUIDeleteSquare($hSquare_GUI)
    If IsHWnd($hSquare_GUI) And $hSquare_GUI <> $Main_GUI Then GUIDelete($hSquare_GUI)
EndFunc

Func _ControlGetHovered()
    Local $aRet = DllCall("user32.dll", "int", "WindowFromPoint", "long", MouseGetPos(0), "long", MouseGetPos(1))
    If Not IsArray($aRet) Then Return SetError(1, 0, 0)
    Return HWnd($aRet[0])
EndFunc

Func _HwndToID($hWnd)
    If Not IsHWnd($hWnd) Then Return SetError(1, 0, 0)
    
    Local $aRet = DllCall("user32.dll", "int", "GetDlgCtrlID", "hwnd", $hWnd)
    If Not IsArray($aRet) Then Return SetError(1, 0, 0)
    
    Return $aRet[0]
EndFunc

Func _GUISetHole($hWin, $i_X, $i_Y, $i_SizeW, $i_SizeH)
    Local $aWinPos, $Outer_Rgn, $Inner_Rgn, $Wh, $Combined_Rgn
    Local Const $RGN_DIFF = 4
    $aWinPos = WinGetPos($hWin)
    
    $Outer_Rgn = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", 0, "long", 0, "long", $aWinPos[2], "long", $aWinPos[3])
    $Inner_Rgn = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", $i_Y, "long", $i_Y, "long", $i_Y + $i_SizeW, _
            "long", $i_Y + $i_SizeH)
    $Combined_Rgn = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", 0, "long", 0, "long", 0, "long", 0)
    DllCall("gdi32.dll", "long", "CombineRgn", "long", $Combined_Rgn[0], "long", $Outer_Rgn[0], "long", $Inner_Rgn[0], _
            "int", $RGN_DIFF)
    DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $hWin, "long", $Combined_Rgn[0], "int", 1)
EndFunc

Func _IdleWait($IdleSec=0)
    Local $iSave, $stLastInput = DllStructCreate("uint;dword")
    DllStructSetData($stLastInput, 1, DllStructGetSize($stLastInput))
    DllCall("user32.dll", "int", "GetLastInputInfo", "ptr", DllStructGetPtr($stLastInput))
    Do
        $iSave = DllStructGetData($stLastInput, 2)
        Sleep(20)
        DllCall("user32.dll", "int", "GetLastInputInfo", "ptr", DllStructGetPtr($stLastInput))
    Until (DllStructGetData($stLastInput, 2) - $iSave) > $IdleSec
    Return DllStructGetData($stLastInput, 2) - $iSave
EndFunc

Func WM_WINDOWPOSCHANGED($hWndGUI, $MsgID, $WParam, $LParam)
    If $hWndGUI <> $Main_GUI Then Return $GUI_RUNDEFMSG
    GUIDeleteSquare($hSquare_GUI)
    Check_Highlight_Controls_Proc()
    $Last_hControl = -1
EndFunc

Func QuitApp()
    Exit
EndFunc

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: 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 Program

AutoIt_Icon_small.pngUDFs: 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
 
AutoIt_Icon_small.pngExamples: 
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 AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

It's work, it's just the syntax check probably not allows to use this since the variable already declared as constant.

Yes, if the variable is already declared (it is for me) then this stops the script from running so I think the Assign is better.

The issue with windows movements is solved partialy, the part that i can not solve, is that when the window is behind another one, the frame is visible on top of that forground window, but maybe it's ok, maybe this how it should be

I think this way is better, after all you are trying to outline the window so that's what it does. It's a question of how you sell it . In developing this product our researchers have come up with a way of showing the extent of the window even when it's partially hidden, and we are including this at no extra cost.

Looks pretty good now. I like the idea of using the Gui_Hole.

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

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...