Jump to content

Creating A Border Around A Listview Won't Disappear


Go to solution Solved by jdelaney,

Recommended Posts

Hi all,

I'm trying to create a highlighted border around any control that I hover the mouse cursor over. I'm going for the same effect as Au3Info performs. However, when I hover over a listview control, the border doesn't disappear when I move the cursor off - it just remains, whereas when I hover over a button control, the border disappears when I move off of it. How can I fix this? Below is a sample replicator.

#include <GUIConstants.au3>
#include <WinAPI.au3>

Global $hGUI = GUICreate("Test", 500, 500)
$Button = GUICtrlCreateButton("Test", 100, 100, 85, 45)
$ListView = GUICtrlCreateListView("Test", 100, 200, 200, 200)

GUISetState(@SW_SHOW)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop
    EndSwitch

    If _ControlGetHoveredID() = $Button Then _ControlSetBorder($Button, 0x00FFFF)
    If _ControlGetHoveredID() = $ListView Then _ControlSetBorder($ListView, 0x00FFFF)
WEnd

Func _ControlSetBorder($iCtrl, $iColor)
    _WinAPI_DrawRect($hGUI, ControlGetHandle($hGUI, "", $iCtrl), $iColor, 0)
    _WinAPI_DrawRect($hGUI, ControlGetHandle($hGUI, "", $iCtrl), $iColor, 1)
    _WinAPI_DrawRect($hGUI, ControlGetHandle($hGUI, "", $iCtrl), $iColor, 2)
    _WinAPI_DrawRect($hGUI, ControlGetHandle($hGUI, "", $iCtrl), $iColor, 3)
EndFunc

Func _WinAPI_DrawRect($hWnd, $hCtrl, $iColor, $iThickness = 0)
    Local $hDC = _WinAPI_GetDC($hWnd)

    Local $aPos = ControlGetPos($hWnd, "", $hCtrl)
    Local $tRect = DllStructCreate($tagRECT)

    DllStructSetData($tRect, 1, ($aPos[0] + $iThickness))
    DllStructSetData($tRect, 2, ($aPos[1] + $iThickness))
    DllStructSetData($tRect, 3, ($aPos[0] + $aPos[2]) - $iThickness)
    DllStructSetData($tRect, 4, ($aPos[1] + $aPos[3]) - $iThickness)

    Local $hBrush = _WinAPI_CreateSolidBrush($iColor)
    _WinAPI_FrameRect($hDC, DllStructGetPtr($tRect), $hBrush)

    ; Clear the resources
    _WinAPI_DeleteObject($hBrush)
    _WinAPI_ReleaseDC(0, $hDC)
EndFunc

Func _ControlGetHoveredID()
    Local $iOld_Opt_MCM = Opt("MouseCoordMode", 1)

    Local $hRet = DllCall("user32.dll", "int", "WindowFromPoint", "long", MouseGetPos(0), "long", MouseGetPos(1))

    $hRet = DllCall("user32.dll", "int", "GetDlgCtrlID", "hwnd", $hRet[0])
    If $hRet[0] < 0 Then $hRet[0] = 0

    Opt("MouseCoordMode", $iOld_Opt_MCM)

    Return $hRet[0]
EndFunc
Link to comment
Share on other sites

Switch _ControlGetHoveredID() 
        Case $Button 
             _ControlSetBorder($Button, 0x00FFFF)
        Case $ListView 
             _ControlSetBorder($ListView, 0x00FFFF)
        Case Else
            _WinAPI_RedrawWindow($hGUI, "", "", BitOR($RDW_INVALIDATE, $RDW_UPDATENOW))
    EndSwitch

This is for the concept, not a very clean way though  :)

Link to comment
Share on other sites

Thank you! That works very well in my reproducer, but it seems to be causing a lot of flickering in my script. I'm trying to use this on a secondary window, not a GUI created within the script and this window (which is an installshield installer window) flickers like crazy because of all the redraws. Is there a way to minimize this? I can't quite seem to figure this one out. Thanks!

Here's another reproducer that shows what I'm referring to. If you hover your mouse cursor over an empty part of the window, it should flicker.

#include <Array.au3>
#include <GUIConstants.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>

$sWinTitle = "Disk Cleanup : Drive Selection"
$iPid = Run("cleanmgr.exe", @SystemDir)
Sleep(1000)
Global $hGUI = WinGetHandle($sWinTitle)

$aControls = WinGetAllControls($sWinTitle)

While ProcessExists($iPid)
    $iCtrlID = _ControlGetHoveredID()
    $iHoverCtrl = _ArraySearch($aControls, $iCtrlID)
    Select
        Case $iHoverCtrl > 0
            If ControlGetHandle($sWinTitle, "", $iCtrlID) = $aControls[$iHoverCtrl][1] Then _ControlSetBorder($iCtrlID, 0x00FFFF)
        Case Else
            _WinAPI_RedrawWindow(WinGetHandle($sWinTitle), "", "", BitOR($RDW_INVALIDATE, $RDW_UPDATENOW))
    EndSelect
WEnd

Func _ControlSetBorder($iCtrl, $iColor)
    _WinAPI_DrawRect($hGUI, ControlGetHandle($hGUI, "", $iCtrl), $iColor, 0)
    _WinAPI_DrawRect($hGUI, ControlGetHandle($hGUI, "", $iCtrl), $iColor, 1)
    _WinAPI_DrawRect($hGUI, ControlGetHandle($hGUI, "", $iCtrl), $iColor, 2)
    _WinAPI_DrawRect($hGUI, ControlGetHandle($hGUI, "", $iCtrl), $iColor, 3)
EndFunc

Func _WinAPI_DrawRect($hWnd, $hCtrl, $iColor, $iThickness = 0)
    Local $hDC = _WinAPI_GetDC($hWnd)

    Local $aPos = ControlGetPos($hWnd, "", $hCtrl)
    Local $tRect = DllStructCreate($tagRECT)

    DllStructSetData($tRect, 1, ($aPos[0] + $iThickness))
    DllStructSetData($tRect, 2, ($aPos[1] + $iThickness))
    DllStructSetData($tRect, 3, ($aPos[0] + $aPos[2]) - $iThickness)
    DllStructSetData($tRect, 4, ($aPos[1] + $aPos[3]) - $iThickness)

    Local $hBrush = _WinAPI_CreateSolidBrush($iColor)
    _WinAPI_FrameRect($hDC, DllStructGetPtr($tRect), $hBrush)

    ; Clear the resources
    _WinAPI_DeleteObject($hBrush)
    _WinAPI_ReleaseDC(0, $hDC)
EndFunc

Func _ControlGetHoveredID()
    Local $iOld_Opt_MCM = Opt("MouseCoordMode", 1)

    Local $hRet = DllCall("user32.dll", "int", "WindowFromPoint", "long", MouseGetPos(0), "long", MouseGetPos(1))

    $hRet = DllCall("user32.dll", "int", "GetDlgCtrlID", "hwnd", $hRet[0])
    If $hRet[0] < 0 Then $hRet[0] = 0

    Opt("MouseCoordMode", $iOld_Opt_MCM)

    Return $hRet[0]
EndFunc

Func WinGetAllControls($hCallersWindow)
    ; Get all list of controls
    $sClassList = WinGetClassList($hCallersWindow)
    ; Create array
    $aClassList = StringSplit($sClassList, @CRLF, 2)
    ; Sort array
    _ArraySort($aClassList)
    _ArrayDelete($aClassList, 0)

    ; Set the array and its size to be returned
    Local $aControls[UBound($aClassList)][8]

    ; Loop
    Local $iCurrentClass = "", $iCurrentCount = 1, $iTotalCounter = 1

    For $i = 0 To UBound($aClassList) - 1
        If $aClassList[$i] = $iCurrentClass Then
            $iCurrentCount += 1
        Else
            $iCurrentClass = $aClassList[$i]
            $iCurrentCount = 1
        EndIf

        $hControl = ControlGetHandle($hCallersWindow, "", "[CLASSNN:" & $iCurrentClass & $iCurrentCount & "]")
        $sText = StringRegExpReplace(ControlGetText($hCallersWindow, "", $hControl), "[\n\r]", "{@CRLF}")
        $aPos = ControlGetPos($hCallersWindow, "", $hControl)
        $sControlID = _WinAPI_GetDlgCtrlID($hControl)

        $aControls[$i][0] = $sControlID
        $aControls[$i][1] = $hControl
        $aControls[$i][2] = $iCurrentClass & $iCurrentCount
        $aControls[$i][7] = $sText
        If IsArray($aPos) Then
            $aControls[$i][3] = $aPos[0]
            $aControls[$i][4] = $aPos[1]
            $aControls[$i][5] = $aPos[2]
            $aControls[$i][6] = $aPos[3]
            ConsoleWrite("Func=[Var_GetAllWindowsControls]: ControlCounter=[" & StringFormat("%3s", $iTotalCounter) & "] ControlID=[" & StringFormat("%5s", $sControlID) & "] Handle=[" & StringFormat("%10s", $hControl) & "] ClassNN=[" & StringFormat("%19s", $iCurrentClass & $iCurrentCount) & "] XPos=[" & StringFormat("%4s", $aPos[0]) & "] YPos=[" & StringFormat("%4s", $aPos[1]) & "] Width=[" & StringFormat("%4s", $aPos[2]) & "] Height=[" & StringFormat("%4s", $aPos[3]) & "] Text=[" & $sText & "]." & @CRLF)
        Else
            $aControls[$i][3] = "winclosed"
            $aControls[$i][4] = "winclosed"
            $aControls[$i][5] = "winclosed"
            $aControls[$i][6] = "winclosed"
            ConsoleWrite("Func=[Var_GetAllWindowsControls]: ControlCounter=[" & StringFormat("%3s", $iTotalCounter) & "] ControlID=[" & StringFormat("%5s", $sControlID) & "] Handle=[" & StringFormat("%10s", $hControl) & "] ClassNN=[" & StringFormat("%19s", $iCurrentClass & $iCurrentCount) & "] XPos=[winclosed] YPos=[winclosed] Width=[winclosed] Height=[winclosed] Text=[" & $sText & "]." & @CRLF)
        EndIf
        If Not WinExists($hCallersWindow) Then ExitLoop
        $iTotalCounter += 1
    Next

    If IsArray($aControls) Then
        Return $aControls
    Else
        Return -1
    EndIf
EndFunc
Link to comment
Share on other sites

  • Solution

Haha, nice, using a modification of my get all controls function :)

This is a little better, grabs the window based on the pid:

#include <Array.au3>
#include <GUIConstants.au3>
#include <WinAPI.au3>
#include <WinAPIex.au3>
#include <WindowsConstants.au3>

$sWinTitle = "Disk Cleanup : Drive Selection"
$iPid = Run("cleanmgr.exe", @SystemDir)

$a = ""
Local $iTimer = TimerInit() ; start timer
While Not IsArray($a) And TimerDiff($iTimer)<15000 ; If no array exists and timer is less than 5 secs
    $a = _WinAPI_EnumProcessWindows ($iPID,True) ; remake array with current windows
WEnd

If IsArray($a) Then
    $hGUI = $a[1][0]
    ConsoleWrite($hGUI & @CRLF)
Else
    ConsoleWrite("unable to find window" & @CRLF)
    Exit
EndIf

$aControls = WinGetAllControls($hGUI)

While ProcessExists($iPid)
    $iCtrlID = _ControlGetHoveredID()
    $iHoverCtrl = _ArraySearch($aControls, $iCtrlID)
    Select
        Case $iHoverCtrl > 0
            If ControlGetHandle($hGUI, "", $iCtrlID) = $aControls[$iHoverCtrl][1] Then _ControlSetBorder($iCtrlID, 0x00FFFF)
        Case Else
            _WinAPI_RedrawWindow(WinGetHandle($hGUI), "", "", BitOR($RDW_INVALIDATE, $RDW_UPDATENOW))
    EndSelect
WEnd

Func _ControlSetBorder($iCtrl, $iColor)
    _WinAPI_DrawRect($hGUI, ControlGetHandle($hGUI, "", $iCtrl), $iColor, 0)
    _WinAPI_DrawRect($hGUI, ControlGetHandle($hGUI, "", $iCtrl), $iColor, 1)
    _WinAPI_DrawRect($hGUI, ControlGetHandle($hGUI, "", $iCtrl), $iColor, 2)
    _WinAPI_DrawRect($hGUI, ControlGetHandle($hGUI, "", $iCtrl), $iColor, 3)
EndFunc

Func _WinAPI_DrawRect($hWnd, $hCtrl, $iColor, $iThickness = 0)
    Local $hDC = _WinAPI_GetDC($hWnd)

    Local $aPos = ControlGetPos($hWnd, "", $hCtrl)
    Local $tRect = DllStructCreate($tagRECT)

    DllStructSetData($tRect, 1, ($aPos[0] + $iThickness))
    DllStructSetData($tRect, 2, ($aPos[1] + $iThickness))
    DllStructSetData($tRect, 3, ($aPos[0] + $aPos[2]) - $iThickness)
    DllStructSetData($tRect, 4, ($aPos[1] + $aPos[3]) - $iThickness)

    Local $hBrush = _WinAPI_CreateSolidBrush($iColor)
    _WinAPI_FrameRect($hDC, DllStructGetPtr($tRect), $hBrush)

    ; Clear the resources
    _WinAPI_DeleteObject($hBrush)
    _WinAPI_ReleaseDC(0, $hDC)
EndFunc

Func _ControlGetHoveredID()
    Local $iOld_Opt_MCM = Opt("MouseCoordMode", 1)

    Local $hRet = DllCall("user32.dll", "int", "WindowFromPoint", "long", MouseGetPos(0), "long", MouseGetPos(1))

    $hRet = DllCall("user32.dll", "int", "GetDlgCtrlID", "hwnd", $hRet[0])
    If $hRet[0] < 0 Then $hRet[0] = 0

    Opt("MouseCoordMode", $iOld_Opt_MCM)

    Return $hRet[0]
EndFunc

Func WinGetAllControls($hCallersWindow)
    ; Get all list of controls
    $sClassList = WinGetClassList($hCallersWindow)
    ; Create array
    $aClassList = StringSplit($sClassList, @CRLF, 2)
    ; Sort array
    _ArraySort($aClassList)
    _ArrayDelete($aClassList, 0)

    ; Set the array and its size to be returned
    Local $aControls[UBound($aClassList)][8]

    ; Loop
    Local $iCurrentClass = "", $iCurrentCount = 1, $iTotalCounter = 1

    For $i = 0 To UBound($aClassList) - 1
        If $aClassList[$i] = $iCurrentClass Then
            $iCurrentCount += 1
        Else
            $iCurrentClass = $aClassList[$i]
            $iCurrentCount = 1
        EndIf

        $hControl = ControlGetHandle($hCallersWindow, "", "[CLASSNN:" & $iCurrentClass & $iCurrentCount & "]")
        $sText = StringRegExpReplace(ControlGetText($hCallersWindow, "", $hControl), "[\n\r]", "{@CRLF}")
        $aPos = ControlGetPos($hCallersWindow, "", $hControl)
        $sControlID = _WinAPI_GetDlgCtrlID($hControl)

        $aControls[$i][0] = $sControlID
        $aControls[$i][1] = $hControl
        $aControls[$i][2] = $iCurrentClass & $iCurrentCount
        $aControls[$i][7] = $sText
        If IsArray($aPos) Then
            $aControls[$i][3] = $aPos[0]
            $aControls[$i][4] = $aPos[1]
            $aControls[$i][5] = $aPos[2]
            $aControls[$i][6] = $aPos[3]
            ConsoleWrite("Func=[Var_GetAllWindowsControls]: ControlCounter=[" & StringFormat("%3s", $iTotalCounter) & "] ControlID=[" & StringFormat("%5s", $sControlID) & "] Handle=[" & StringFormat("%10s", $hControl) & "] ClassNN=[" & StringFormat("%19s", $iCurrentClass & $iCurrentCount) & "] XPos=[" & StringFormat("%4s", $aPos[0]) & "] YPos=[" & StringFormat("%4s", $aPos[1]) & "] Width=[" & StringFormat("%4s", $aPos[2]) & "] Height=[" & StringFormat("%4s", $aPos[3]) & "] Text=[" & $sText & "]." & @CRLF)
        Else
            $aControls[$i][3] = "winclosed"
            $aControls[$i][4] = "winclosed"
            $aControls[$i][5] = "winclosed"
            $aControls[$i][6] = "winclosed"
            ConsoleWrite("Func=[Var_GetAllWindowsControls]: ControlCounter=[" & StringFormat("%3s", $iTotalCounter) & "] ControlID=[" & StringFormat("%5s", $sControlID) & "] Handle=[" & StringFormat("%10s", $hControl) & "] ClassNN=[" & StringFormat("%19s", $iCurrentClass & $iCurrentCount) & "] XPos=[winclosed] YPos=[winclosed] Width=[winclosed] Height=[winclosed] Text=[" & $sText & "]." & @CRLF)
        EndIf
        If Not WinExists($hCallersWindow) Then ExitLoop
        $iTotalCounter += 1
    Next

    If IsArray($aControls) Then
        Return $aControls
    Else
        Return -1
    EndIf
EndFunc

As for your 'flashing' you would have to create a variable for the handle of the control currently painted...and then, if in the painting function the current moused over control is the currently painted, then don't re-paint.

This is a little better...and will function on any window the process creates (if there are ever more than one at the same time, some modifications will be needed)

#include <Array.au3>
#include <GUIConstants.au3>
#include <WinAPI.au3>
#include <WinAPIex.au3>
#include <WindowsConstants.au3>

$sWinTitle = "Disk Cleanup : Drive Selection"

$iPid = Run("cleanmgr.exe", @SystemDir)
$a = ""
Local $iTimer = TimerInit() ; start timer
While Not IsArray($a) And TimerDiff($iTimer)<15000 ; If no array exists and timer is less than 5 secs
    $a = _WinAPI_EnumProcessWindows ($iPID,True) ; remake array with current windows
WEnd

If IsArray($a) Then
    Global $hGUI = $a[1][0]
    ConsoleWrite($hGUI & @CRLF)
Else
    ConsoleWrite("unable to find window" & @CRLF)
    Exit
EndIf

$hPrevious = ""
While ProcessExists($iPid)
    If WinExists($hGUI) Then
        $hCurrent = _ControlGetHoveredID()

        If IsHWnd($hCurrent) And _WinAPI_GetDlgCtrlID($hCurrent)>0 Then
            If $hPrevious <> $hCurrent Then
                $hPrevious = $hCurrent
                _WinAPI_RedrawWindow($hGUI, "", "", BitOR($RDW_INVALIDATE, $RDW_UPDATENOW))
                _ControlSetBorder($hCurrent, 0x00FFFF)
            EndIf
        Else
            _WinAPI_RedrawWindow($hGUI, "", "", BitOR($RDW_INVALIDATE, $RDW_UPDATENOW))
        EndIf
    Else
        $a = ""
        Local $iTimer = TimerInit() ; start timer
        While Not IsArray($a) And TimerDiff($iTimer)<15000 ; If no array exists and timer is less than 5 secs
            $a = _WinAPI_EnumProcessWindows ($iPID,True) ; remake array with current windows
        WEnd
        If IsArray($a) Then
            $hGUI = $a[1][0]
            ConsoleWrite($hGUI & @CRLF)
        Else
            ConsoleWrite("unable to find window" & @CRLF)
            Exit
        EndIf
    EndIf

WEnd

Func _ControlSetBorder($hCtrl, $iColor)
    _WinAPI_DrawRect($hGUI, $hCtrl, $iColor, 0)
    _WinAPI_DrawRect($hGUI, $hCtrl, $iColor, 1)
    _WinAPI_DrawRect($hGUI, $hCtrl, $iColor, 2)
    _WinAPI_DrawRect($hGUI, $hCtrl, $iColor, 3)
EndFunc

Func _WinAPI_DrawRect($hWnd, $hCtrl, $iColor, $iThickness = 0)
    Local $hDC = _WinAPI_GetDC($hWnd)

    Local $aPos = ControlGetPos($hWnd, "", $hCtrl)
    Local $tRect = DllStructCreate($tagRECT)

    DllStructSetData($tRect, 1, ($aPos[0] + $iThickness))
    DllStructSetData($tRect, 2, ($aPos[1] + $iThickness))
    DllStructSetData($tRect, 3, ($aPos[0] + $aPos[2]) - $iThickness)
    DllStructSetData($tRect, 4, ($aPos[1] + $aPos[3]) - $iThickness)

    Local $hBrush = _WinAPI_CreateSolidBrush($iColor)
    _WinAPI_FrameRect($hDC, DllStructGetPtr($tRect), $hBrush)

    ; Clear the resources
    _WinAPI_DeleteObject($hBrush)
    _WinAPI_ReleaseDC(0, $hDC)
EndFunc

Func _ControlGetHoveredID()
    Local $iOld_Opt_MCM = Opt("MouseCoordMode", 1)

    Local $hRet = DllCall("user32.dll", "int", "WindowFromPoint", "long", MouseGetPos(0), "long", MouseGetPos(1))

    $hReturn = HWnd($hRet[0])

    Opt("MouseCoordMode", $iOld_Opt_MCM)
    If $hReturn And IsHWnd($hReturn) Then
        Return $hReturn
    Else
        Return False
    EndIf
EndFunc

Func WinGetAllControls($hCallersWindow)
    ; Get all list of controls
    $sClassList = WinGetClassList($hCallersWindow)
    ; Create array
    $aClassList = StringSplit($sClassList, @CRLF, 2)
    ; Sort array
    _ArraySort($aClassList)
    _ArrayDelete($aClassList, 0)

    ; Set the array and its size to be returned
    Local $aControls[UBound($aClassList)][8]

    ; Loop
    Local $iCurrentClass = "", $iCurrentCount = 1, $iTotalCounter = 1

    For $i = 0 To UBound($aClassList) - 1
        If $aClassList[$i] = $iCurrentClass Then
            $iCurrentCount += 1
        Else
            $iCurrentClass = $aClassList[$i]
            $iCurrentCount = 1
        EndIf

        $hControl = ControlGetHandle($hCallersWindow, "", "[CLASSNN:" & $iCurrentClass & $iCurrentCount & "]")
        $sText = StringRegExpReplace(ControlGetText($hCallersWindow, "", $hControl), "[\n\r]", "{@CRLF}")
        $aPos = ControlGetPos($hCallersWindow, "", $hControl)
        $sControlID = _WinAPI_GetDlgCtrlID($hControl)

        $aControls[$i][0] = $sControlID
        $aControls[$i][1] = $hControl
        $aControls[$i][2] = $iCurrentClass & $iCurrentCount
        $aControls[$i][7] = $sText
        If IsArray($aPos) Then
            $aControls[$i][3] = $aPos[0]
            $aControls[$i][4] = $aPos[1]
            $aControls[$i][5] = $aPos[2]
            $aControls[$i][6] = $aPos[3]
            ConsoleWrite("Func=[Var_GetAllWindowsControls]: ControlCounter=[" & StringFormat("%3s", $iTotalCounter) & "] ControlID=[" & StringFormat("%5s", $sControlID) & "] Handle=[" & StringFormat("%10s", $hControl) & "] ClassNN=[" & StringFormat("%19s", $iCurrentClass & $iCurrentCount) & "] XPos=[" & StringFormat("%4s", $aPos[0]) & "] YPos=[" & StringFormat("%4s", $aPos[1]) & "] Width=[" & StringFormat("%4s", $aPos[2]) & "] Height=[" & StringFormat("%4s", $aPos[3]) & "] Text=[" & $sText & "]." & @CRLF)
        Else
            $aControls[$i][3] = "winclosed"
            $aControls[$i][4] = "winclosed"
            $aControls[$i][5] = "winclosed"
            $aControls[$i][6] = "winclosed"
            ConsoleWrite("Func=[Var_GetAllWindowsControls]: ControlCounter=[" & StringFormat("%3s", $iTotalCounter) & "] ControlID=[" & StringFormat("%5s", $sControlID) & "] Handle=[" & StringFormat("%10s", $hControl) & "] ClassNN=[" & StringFormat("%19s", $iCurrentClass & $iCurrentCount) & "] XPos=[winclosed] YPos=[winclosed] Width=[winclosed] Height=[winclosed] Text=[" & $sText & "]." & @CRLF)
        EndIf
        If Not WinExists($hCallersWindow) Then ExitLoop
        $iTotalCounter += 1
    Next

    If IsArray($aControls) Then
        Return $aControls
    Else
        Return -1
    EndIf
EndFunc
Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

Haha, nice, using a modification of my get all controls function :)

 

It's a great function! Thanks for that! ^_^

Thank you for that tip on the flashing. My head just wasn't working. Here's how I "fixed" the flashing:

While ProcessExists($iPid)
    $iCtrlID = _ControlGetHoveredID()
    $iCtrlHnd = ControlGetHandle($sWinTitle, "", $iCtrlID)
    $iHoverCtrl = _ArraySearch($aControls, $iCtrlID)
    Select
        Case $iHoverCtrl > 0
            If ($iCtrlHnd = $aControls[$iHoverCtrl][1]) Then
                $iPreviousHnd = $iCtrlHnd
                _ControlSetBorder($iCtrlID, 0x00FFFF)
            EndIf
        Case Else
            If ($iPreviousHnd <> $iCtrlHnd) Then
                $iPreviousHnd = $iCtrlHnd
                _WinAPI_RedrawWindow($hGUI, "", "", BitOR($RDW_INVALIDATE, $RDW_UPDATENOW))
            EndIf
    EndSelect
WEnd
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...