Код:
ControlCommand('название окна', 'текст окна', controlID, 'GetLine', ControlCommand('название окна', 'текст окна', controlID, 'GetLineCount'))
Код:
#region: - Option
Opt('MustDeclareVars', 1)
Opt('TrayIconDebug', 1)
Opt('TrayIconHide', 0)
Opt('SendKeyDelay', 1)
#endregion
#region: - Global
Global $iPid, $hHwd
Global $sGetEditLine
#endregion
$iPid = Run('notepad.exe')
While 1
$hHwd = _ProcessGetWindow($iPid, 1)
If IsHWnd($hHwd) Then ExitLoop
WEnd
ControlSetText($hHwd, '', '[CLASS:Edit; INSTANCE:1]', 'Строка 1' & @CRLF & 'Строка 2' & @CRLF & 'Строка 3')
Sleep(5)
$sGetEditLine = ControlCommand($hHwd, '', '[CLASS:Edit; INSTANCE:1]', 'GetLine', ControlCommand($hHwd, '', '[CLASS:Edit; INSTANCE:1]', 'GetLineCount'))
MsgBox(64, 'Результат', 'Последняя строчка: ' & @CRLF & @CRLF & $sGetEditLine)
ProcessClose($iPid)
Func _ProcessGetWindow($iPID, $iRet=-1)
Local $aWinList = WinList()
Local $aRet[2]
If IsString($iPID) Then $iPID = ProcessExists($iPID)
For $i = 1 To UBound($aWinList)-1
If WinGetProcess($aWinList[$i][1]) = $iPID Then
$aRet[0] = $aWinList[$i][0] ;Title
$aRet[1] = $aWinList[$i][1] ;WinHandle
If $iRet = 0 Then Return $aRet[0]
If $iRet = 1 Then Return $aRet[1]
Return $aRet
EndIf
Next
Return SetError(1, 0, $aRet)
EndFunc
|