本帖最后由 qq413774005 于 2023-8-22 10:10 编辑 #include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiStatusBar.au3>
$txtFile = @ScriptDir & "\大于64KB出错.txt"
$txtLang = 9500;读取最大行
$n = 0
;----------------------------------------------------
$Form1 = GUICreate("", 640, 505)
Local $idMyedit = GUICtrlCreateEdit("", 0, 0, 640, 480, $ES_AUTOVSCROLL + $WS_VSCROLL)
GUICtrlSetLimit($idMyedit, 100000000);解除edit控制限制为1亿字符
;任务栏
$StatusBar1 = _GUICtrlStatusBar_Create($Form1)
_GUICtrlStatusBar_SetMinHeight($StatusBar1, 25)
_GUICtrlStatusBar_SetText($StatusBar1, "开始")
GUISetState(@SW_SHOW)
;-----------------------------------------------------
Local $hFileOpen = FileOpen($txtFile, 0)
;----------------------------
While 1
$line = FileReadLine($hFileOpen)
If @error = -1 Then
FileClose($hFileOpen);文本文件读取异常就关闭
ExitLoop
EndIf
If $n > $txtLang Then
ExitLoop
Else
GUICtrlSetData($idMyedit, $line & @CRLF, 0)
_GUICtrlStatusBar_SetText($StatusBar1, $n & "行")
EndIf
$n = $n + 1
;----------------------------------
WEnd
;----------------------------
FileClose($hFileOpen);文本文件读取异常就关闭
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd
|