by G. van den Hoven (3 Submissions)
Category: Files/File Controls/Input/Output
Compatability: Visual Basic 3.0
Difficulty: Intermediate
Date Added: Wed 3rd February 2021
Rating: (4 Votes)
This code is designed for reading text files. i have written this code because i did not want to use the slow "open for input..." and "freefile" bla bla code...
I know i coul do this via the richedit control, but i wanted to know how to do it via api, and maybe you to...
This code is using the "CreateFile" Api, which must be called differently in windows 2000. Therefore, i added a "IsWin2000" function to check for windows 2000.
Update: Now added a class which wraps the module, lot's of events and functionality. it's 50ms slower in read (with my test file)
Class module includes also function ReadCharacters which reads the specified ammount of characters from the open file.
Side Effects
You could get an "out of memory error" when you try to read text files larger then 32768 bytes, and put that into a textbox. Therefore, if you want to display text, use richedit boxes.
API DeclarationsAll in module, sample project included.