Tools Links Login

Read a textfile via api calls (v1.1)

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.

Original Author: G. van den Hoven

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 Declarations

All in module, sample project included.

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 100 times

Categories

Visual Basic 6

Attachments

CODE_UPLOAD1286012202000.zip
Posted: 9/3/2020 3:45:00 PM
Size: 7,364 bytes


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.