Das Skript dürfte selbsterklärend sein. Man kann damit das notepad als Control einbinden. Dabei kann auch Text ausgelesen / eingegeben werden, auch Resize ist möglich.
Spoiler anzeigen
#include <WindowsConstants.au3>
#include <WinAPI.au3>
#include <Constants.au3>
Local $Bound = 0
$hGUI = GUICreate("Embedded Notepad", 800, 600, -1, -1, $WS_SIZEBOX)
$hNotepad = _GUICtrlNotepad_Create($hGUI, 5, 5, 788, 505)
$hCount = GUICtrlCreateLabel("0 Zeilen im Notepad | Erste Buchstaben sind ''", 5, 515, 500, 100)
GUISetState()
While GUIGetMsg() <> -3
$nBound = UBound(StringSplit(_GUICtrlNotepad_GetText($hNotepad), @CRLF, 3))
If $nBound <> $Bound Then
$Bound = $nBound
GUICtrlSetData($hCount, $Bound & " Zeilen im Notepad | Erste Buchstaben sind '"&StringLeft(_GUICtrlNotepad_GetText($hNotepad),3)&"'")
EndIf
WEnd
; # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
[/autoit] [autoit][/autoit] [autoit]Func _GUICtrlNotepad_Delete($hNote)
Return WinClose($hNote)
EndFunc
Func _GUICtrlNotepad_Move($hNote, $iLeft, $iTop, $iWidth, $iHeight)
_WinAPI_MoveWindow($hNote, $iLeft, $iTop, $iWidth, $iHeight, True)
EndFunc
Func _GUICtrlNotepad_SetText($hNote, $sText)
Return ControlSetText($hNote, "", "Edit1", $sText)
EndFunc
Func _GUICtrlNotepad_GetText($hNote)
Return ControlGetText($hNote, "", "Edit1")
EndFunc
Func _GUICtrlNotepad_Create($hParent, $iLeft, $iTop, $iWidth, $iHeight)
$iPID = Run("notepad.exe", "", @SW_MINIMIZE)
WinWait("[class:Notepad]")
$hNotepad = _WinGetByPID($iPID)
_WinAPI_SetParent($hNotepad, $hParent)
_WinAPI_MoveWindow($hNotepad, $iLeft, $iTop, $iWidth, $iHeight, True)
_WinAPI_SetWindowLong($hNotepad, $GWL_STYLE, $WS_POPUP + $WS_VISIBLE)
WinSetState($hNotepad, "", @SW_SHOW)
Return $hNotepad
EndFunc
Func _WinGetByPID($iPID) ; 0 Will Return 1 Base Array & 1 Will Return The First Window.
Local $aError[1] = [0], $aWinList, $sReturn
If IsString($iPID) Then
$iPID = ProcessExists($iPID)
EndIf
$aWinList = WinList()
For $A = 1 To $aWinList[0][0]
If WinGetProcess($aWinList[$A][1]) = $iPID And BitAND(WinGetState($aWinList[$A][1]), 2) Then
Return $aWinList[$A][1]
$sReturn &= $aWinList[$A][1] & Chr(1)
EndIf
Next
If $sReturn Then
Return StringSplit(StringTrimRight($sReturn, 1), Chr(1))
EndIf
Return SetError(1, 0, $aError)
EndFunc ;==>_WinGetByPID