by Tom Moran (4 Submissions)
Category: Files/File Controls/Input/Output
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating:
(9 Votes)

You don't have to be limited to 64K size files for a for a standard Textbox control in VB6. This small sample project shows you how to load, edit and save plain text files, UNLIMITED by file size using the Standard VB6 Textbox control. It's all done in just a few simple lines of code. Please note that this method works on NT, Windows 2000, XP and Vista. If you're coding for systems that use Win95/98 or ME this method will not work. View the readhuge.txt file for full details. (UPDATE: Changed method from Clipboard method to an API method which is even more efficient and does not mess with any data in the clipboard and the end result is the same. Thanks to Kenneth Buckmaster and Rob C. for their input.)
Side Effects
Method works in NT, 2000, XP and Vista. Does not work in Win85/98 or ME
API Declarations'API's and Const to load large files
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_GETTEXT = &HD
Private Const WM_GETTEXTLENGTH = &HE
Download Breaking the Textbox 64K File Size Limit (UPDATE: Sept. 15th, 2007) (10 KB)
No comments have been posted about Breaking the Textbox 64K File Size Limit (UPDATE: Sept. 15th, 2007). Why not be the first to post a comment about Breaking the Textbox 64K File Size Limit (UPDATE: Sept. 15th, 2007).