I have found only one function here (to load huge file into textbox): https://www.planet-source-code.com/v...69294&lngWId=1
But I also need functions for selecting all text, because native VB functions (.SelStart, .SelLength) can't do that due to 64K characters limit. I know it has to do with SendMessage API but I'm not expert in that field.
Can someone help me to write such replacement functions?
EDIT: Found it, here are functions for loading and selecting huge text into TextBox:
VB Code:
Private Declare Function SendMessage Lib "user32" _
Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, _
ByVal wParam As Long, lParam As Any) As Long
'Private Declare Function GetWindowTextLength Lib "user32" _
Alias "GetWindowTextLengthA" (ByVal hWnd As Long) As Long
Private Const WM_SETTEXT = &HC
'Private Const WM_GETTEXTLENGTH = &HE
Private Const EM_SETSEL = &HB1
Function LoadBig(txt As TextBox, FileOrString As String, Optional IsString As Boolean, Optional Pre As String)
On Error GoTo E
Dim TempText As String
Dim iret As Long
If Not IsString Then
Dim FileNum As Integer
FileNum = FreeFile
' Open the selected file.
Open FileOrString For Input As #FileNum
TempText = Pre & StrConv(InputB(LOF(FileNum), FileNum), vbUnicode)
Else: TempText = Pre & FileOrString
End If
DoEvents
txt.Text = ""
iret = SendMessage(txt.hWnd, WM_SETTEXT, 0&, ByVal TempText)
'iret = SendMessage(txt.hWnd, WM_GETTEXTLENGTH, 0&, ByVal 0&)
'Debug.Print "WM_GETTEXTLENGTH: " & iret
TempText = ""
E: If Not IsString Then Close #FileNum
End Function
Function SelectT(txt As TextBox, SelStart As Long, SelEnd As Long)
Dim iret As Long
Res = SendMessage(txt.hWnd, EM_SETSEL, SelStart, SelEnd)
End Function