Chapter 3. Manipulating Files

Team-Fly    

  
eMbedded Visual Basic: Windows CE and Pocket PC Mobile Applications
By Chris Tacke, Timothy Bassett
Table of Contents


IN THIS CHAPTER

  • The FileSystem and File Controls

  • The Windows CE TreeView Control

  • Creating the PocketExplorer Utility

Most Visual Basic programmers today access files through the familiar Win32 File System Object (commonly called the fso). The fso provides an easy-to-use and quick-to-develop-with object model that works for most text file applications.

When it comes to binary or random access, the fso falters, and VB developers then turn to what's often called free filing probably named as such due to using the FreeFile() method to get an available file number. Free filing is an older, procedural-based method of access files that's valid for any file access, but isn't quite as easy to use as the object-oriented fso.

Although the eVB's FileSystem and File controls don't have the extensive object model that the fso has, they provide just about everything developers could want or need for accessing any type of file-binary or text, sequential or random.

In fact, I find that using these controls has distinct advantages over file programming in Win32 because they wrap the functionality of both free filing and the fso in a nice, compact set of methods and properties. Whether accessing small text configuration files or large binary data files, the FileSystem and File controls are all you'll need.

This chapter explores some of the functionality behind the two controls in the MSCEFileCtl library: FileSystem and File. The controls' uses are limited only by the applications in which they are used and by your coding imagination ; an exhaustive treatment of all the entire library's uses could be a book in itself. We'll cover some of their more common uses, give you ideas on where else you might use them, and add in the use of the TreeView control as well.

In this chapter you will

  • Learn about the object models for the FileSystem and File controls

  • Discover the differences between the FileControl functions and Visual Basic's well-known File System Object (fso)

  • Learn about the object model for the native CE TreeView control

  • Read and traverse a directory tree

  • Use the Open, Read, Write, and Close text files

  • See how to retrieve file attributes, such as size and modify date

  • Examine how to minimize the impact of the CreateObject memory leak

  • Work around the lack of support for properties

As we'll do with all chapters, we will also uncover some of eVB's more subtle nuances that can cause problems and headaches , as well as give coding tips applicable to any eVB application.


Team-Fly    
Top
 


eMbedded Visual BasicR. WindowsR CE and Pocket PC Mobile Applications
eMbedded Visual BasicR. WindowsR CE and Pocket PC Mobile Applications
ISBN: N/A
EAN: N/A
Year: 2001
Pages: 108

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net