函数参考


_GUICtrlEdit_GetText

获取编辑框控件中的文本

#include <GuiEdit.au3>
_GUICtrlEdit_GetText($hWnd)

参数

$hWnd 控件的控件ID/句柄

返回值

成功: 返回编辑控件中的文本
失败: 空字符串

注意/说明

None.

相关

_GUICtrlEdit_SetText, _GUICtrlEdit_AppendText, _GUICtrlEdit_GetTextLen

示例/演示


#include <GuiEdit.au3>
#include <GUIConstantsEx.au3>

$Debug_Ed = False ; Check ClassName being passed to Edit functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
    Local $hEdit

    ; 创建 GUI
    GUICreate("Edit Get Text", 400, 300)
    $hEdit = GUICtrlCreateEdit("", 2, 2, 394, 268)
    GUISetState()

    ; Set Text
    _GUICtrlEdit_SetText($hEdit, "This is a test" & @CRLF & "Another Line" & @CRLF & "Append to the end?")

    ; Get Text
    MsgBox(4160, "信息", _GUICtrlEdit_GetText($hEdit))

    ; 循环直到用户退出
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc   ;==>_Main