What Is a File?
The concept of a file used to be simple, but no more. Under 32-bit Windows, files are complicated and getting more so. COM introduces the concept of structured files that look more like directory trees than the simple files we’re used to. But that’s getting ahead of the story. This version of Visual Basic doesn’t handle structured storage (although you could implement it by using the IStorage interface). Ordinary files have enough new features anyway. Here are some of them:
-
Filenames are long—up to 256 characters. Filenames are case-sensitive (sort of) and can have "Embedded Spaces and.multiple.extensions" as this one does.
-
Files have new dates and times. Under MS-DOS and Windows 3.x, the date of the last file modification was stored with the file. Under Win32, three dates are stored with each file: creation, last modification, and last access. These dates can differ depending on the file system. I’ll have more to say on this later.
-
Files have new attributes—compressed and temporary. You won’t have much reason to deliberately manipulate these attributes under Visual Basic, but you should be aware that documentation for the Visual Basic GetAttr function and SetAttr statement isn’t exactly telling the truth when it lists six file attributes instead of eight.
-
Full file paths can be specified in the UNC format (\\server\share). This isn’t new, but it has become more pervasive. You can always use UNC directory names to access network resources without saving a connection to them.
-
Each file has a document type that controls how it is handled by Windows Explorer and Open dialog boxes. Some of the information that can be associated with a document type includes large and small icons, an OLE verb, a file viewer, and commands for printing and performing drag-and-drop operations. The most common way to define
a document type is to associate it with a filename extension.
-
You can perform new operations on files: delete, copy, move, and rename. You don’t consider those operations new? We’ll see.