函数参考


_WinAPI_GetFocus

检索具有键盘焦点的窗口句柄

#Include <WinAPI.au3>
_WinAPI_GetFocus()

参数

None.

返回值

成功: 返回键盘焦点窗口的句柄
失败: 返回 0

注意/说明

None.

相关

详情参考

在MSDN中搜索


示例/演示


#include <WinAPI.au3>
#include <GUIConstantsEx.au3>

_Main()

Func _Main()
    Local $msg, $btnFocus, $win, $text
    GUICreate("__WinAPI_GetFocus Example", 200, 200)
    $btnFocus = GUICtrlCreateButton("Get Focus", 50, 85, 100, 30)
    GUISetState(@SW_SHOW)
    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                Exit
            Case $msg = $btnFocus
                $win = _WinAPI_GetFocus()
                $text = "Full Title: " & WinGetTitle($win) & @LF
                $text &= "Full Text: " & WinGetText($win) & @LF
                $text &= "Handle: " & WinGetHandle($win) & @LF
                $text &= "Process: " & WinGetProcess($win) & @LF
                MsgBox(4096, "", $text)
        EndSelect
    WEnd
EndFunc   ;==>_Main