ControlGetFocus

首页  后退  前进

ControlGetFocus
down2

ControlGetFocus

返回指定窗口键盘焦点控件的类别名.(Ref#-控件号).

 

ControlGetFocus ( "title" [, "text"] )

参数

title

目标窗口标题, 或句柄, 或类名. 参考窗口标题与文本(高级).

text

[可选] 目标窗口文本. 参见 窗口标题与文本.

返回值

成功:

返回指定窗口键盘焦点控件的 ClassNameNN 类别名.

失败:

返回 "" (空字符串). 设置 @error 为 1, 表示未找到目标窗口.

 

函数示例

#include <MsgBoxConstants.au3>
Example()
Func Example()
    ; Run Notepad
    Run("notepad.exe")
    ; Wait 10 seconds for the Notepad window to appear.
    Local $hWnd = WinWait("[CLASS:Notepad]", "", 10)
    ; Retrieve the control that has keyboard focus in Notepad. The handle returned by WinWait is used for the "title" parameter of ControlGetFocus.
    Local $sControl = ControlGetFocus($hWnd)
    ; Display the control that has keyboard focus.
    MsgBox($MB_SYSTEMMODAL, "", "The control that has keyboard focus in Notepad is: " & $sControl)
    ; Close the Notepad window using the handle returned by WinWait.
    WinClose($hWnd)
EndFunc   ;==>Example

----------------------------------------

 

该函数可以通过命令 exect 调用

参见:

ControlFocus, ControlCommand

例子
copy

tcimg=$cm498 pause=500 exect=$var_scontrol=ControlGetFocus('[CLASS:TBUTTONCHANGEDLG]')||_ViewValues('$var_scontrol') ;; 调用工具栏并获取具有焦点的Control元素

up2

tcimage © Аверин Андрей для Total Commander Image Averin-And@yandex.ru