I’m always looking for sample code, and the setup1.vbp file is an excellent source of reusable code. It comes with VB and is part of the VB setup kit. The contents vary, depending on what version of VB you have, but you’ll find useful examples in each version. For example, the VB5 file sample code does these things:
- Gets the Windows directory.
- Gets the Windows System directory.
- Determines if a file or directory exists.
- Determines if you’re running WinNT or Win95.
- Determines drive type.
- Checks disk space.
- Creates a new path.
- Reads from an INI file.
- Parses date and time.
- Retrieves the short path name of a file containing long file names.
Plus, a whole module works to log errors to an error file. This code is well-commented and can easily be cut and pasted into your project.