小男孩‘自慰网亚洲一区二区,亚洲一级在线播放毛片,亚洲中文字幕av每天更新,黄aⅴ永久免费无码,91成人午夜在线精品,色网站免费在线观看,亚洲欧洲wwwww在线观看

分享

_ControlGetHandleByPos() UDF (v1.0)

 dinghj 2019-04-16

No the reason I was getting the zero return for some controls was that your script did not seem to handle Edit 2 etc they were being renamed as Edit 1

I have modified the script slightly and this seemed to work for me

; ==============================================================================
;
; Function Name:    _ControlGetHandleByPos()
; Description:    Retrieves the internal handle of a control that matches a
;                  given position.
; Parameter(s):  $sTitle -- the title of the window containing the control
;                  $sText  -- the text of the window containing the control
;                  $iX   -- the X coordinate of the control
;                  $IY   -- the Y coordinate of the control
; Requirement(s):   None
; Return Value(s):  On success -- returns the control's handle
;                  On failure -- return and sets @error:
;                                  1 -- could not find window
;                                  2 -- could not find control
; Author(s):        Alex Peters
;
; ==============================================================================

Func _ControlGetHandleByPos($sTitle, $sText, $iX, $iY)

    Local $hWin, $hControl
    Local $iControls, $iLoop, $iUniqueControls
    Local $sClassList, $sClass, $sClassID
    Local $aiControlPos, $avUniqueControls[1][2]

; Determine that the window exists
    $hWin = WinGetHandle($sTitle, $sText)
    If @error Then
        SetError(2)
        Return 0
    EndIf

; Determine the control classes and total number of controls
    $sClassList = WinGetClassList($hWin)
    $iControls = StringLen($sClassList) - StringLen(StringReplace($sClassList, @LF, ""))
    ReDim $avUniqueControls[$iControls][2]

    $iUniqueControls = 0
    While $sClassList
        $sClass = StringLeft($sClassList, StringInStr($sClassList, @LF) - 1)
        $sClassList = StringMid($sClassList, StringLen($sClass) + 2)
        $sClassID = ""
        For $iLoop = 0 To $iUniqueControls - 1
            If $avUniqueControls[$iLoop][0] = $sClass Then;If there is another button then make button 2 loop
                $avUniqueControls[$iLoop][1] = $avUniqueControls[$iLoop][1] + 1;Starts at 0 then increments 1 each time a match is made giving button 2 etc
                $sClassID = $sClass & $avUniqueControls[$iLoop][1];Makes up the correct class ID from above
                ExitLoop
            EndIf
        Next

        If $sClassID = "" Then;This numbers the first controls eg Edit 1
            $avUniqueControls[$iUniqueControls][0] = $sClass
            $avUniqueControls[$iUniqueControls][1] = 1
            $iUniqueControls = $iUniqueControls + 1
            $sClassID = $sClass & "1"
        EndIf
    ; Determine the position of the control in question
        $hControl = ControlGetHandle($hWin, "", $sClassID)
        $aiControlPos = ControlGetPos($hWin, "", $hControl)
        
        If ($aiControlPos[0] = $iX And $aiControlPos[1] = $iY) Then _ 
                Return $hControl
    WEnd

; If we reach this point then no matching control was found
    SetError(1)
    Return 0

EndFunc

The If Not section did not seem to be working for me so I changed it to

If $sClassID = ""
and this seems to work.         

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶 評(píng)論公約

    類似文章 更多