#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate("窗体1", 413, 305, 302, 218)
$Edit1 = GUICtrlCreateEdit("", 0, 0, 409, 297)
GUICtrlSetData(-1, "Edit1",1)
GUICtrlSetData(-1, "Edit1",1)
GUICtrlSetData(-1, "Edit1",1)
GUICtrlSetData(-1, "Edit1",1)
GUICtrlSetData(-1, "Edit6",1)
GUICtrlSetData(-1, "Edit1",1)
GUICtrlSetData(-1, "Edit1",1)
GUICtrlSetData(-1, "Edit1",1)
GUICtrlSetData(-1, "Edit1",1)
GUICtrlSetData(-1, "Edit1",1)
GUICtrlSetData(-1, "Edit1",1)
GUISetState(@SW_SHOW)
GUICtrlSetState(-1, $GUI_FOCUS)
Sleep(2000)
_SetCaretPos(200, 1)
Sleep(2000)
_SetCaretPos(50, 1)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
Func _GetCaretPos()
Local $aXY[2], $iResult, $tBuffer
$tBuffer = DllStructCreate("int X;int Y")
$iResult = DllCall("User32.dll", "int", "GetCaretPos", "ptr", DllStructGetPtr($tBuffer))
$aXY[0] = DllStructGetData($tBuffer, "X")
$aXY[1] = DllStructGetData($tBuffer, "Y")
Return $aXY
EndFunc ;==>_GetCaretPos
Func _SetCaretPos($iX, $iY)
Local $iResult
$iResult = DllCall("User32.dll", "int", "SetCaretPos", "int", $iX, "int", $iY)
Return $iResult[0] <> 0
EndFunc ;==>_SetCaretPos