Jump: Search:

Total Visual SourceBook

Total Visual SourceBook CD and Printed Manual

Microsoft Access 2007/2010 Version
is Shipping!

New features in Total Visual SourceBook for Access, Office 2007 and VB6

Supports Access/Office 2010 (32 bit), 2007, 2003, 2002, 2000, and
Visual Basic 6.0!

Also available for:
Access 97/95


View all FMS products for Microsoft AccessAll Our Microsoft Access Products

SourceBook Info:

Why SourceBook?

 

"The code is exactly how I would like to write code and the algorithms used are very efficient and well-documented."

Van T. Dinh, Microsoft MVP

 

 

 

 

 
Royalty free source code library modules for Microsoft Access, VB6, VBA, OfficeRoyalty free source code library modules for Microsoft Access, VB6, VBA, OfficeVBA and VB6 Source Code Library Download the free trial version of Total Visual SourceBook for Microsoft Access, Office, VB6 and VBA
Category: General VBA/VB6 : File and Disk Operations
Description: Managing disk drives, files, paths, folders, and subfolders with and without Windows API calls

Class: CAPIDisks

Working with disk drives using the Windows API

Although Visual Basic has rudimentary file and disk functionality, you must go to the Windows API to get real power in this area. This class exposes logical drives through a collection of properties and methods, including support for: - Enumerating all logical drives. - Getting drive information such as volume label, free and total space, serial number and more. - Determining if a drive is ready. - Changing a volume label.

Procedure Name

Type

Description

(Declarations) Declarations Declarations and private variables for the CAPIDisks class
DiskFreeSpace Property Gets the free space on the spedified drive.
DiskTotalSpace Property Gets the total disk space on the specified drive.
DriveFileSystemType Property Gets the file system type for the specified logical drive. Possible return values for this function are: FAT, FAT32, NTFS, NTFSC
DriveFlags Property Gets the file system flags for the specified logical drive. This function returns a long integer that is the result of the call to the Windows API GetVolumeInformation function. To see a readable form of this long integer, pass it to the class VolumeFlagsToString method.
DriveLabel Property Gets the label for the specified logical drive.
DriveSerialNumber Property Gets the serial number for the specified logical drive.
DriveType Property Gets the type for the specified logical drive. This property returns a long integer value defined by the following constants in the Windows API: - DRIVE_UNKNOWN - DRIVE_NOROOT - DRIVE_REMOVABLE - DRIVE_FIXED - DRIVE_REMOTE - DRIVE_CDROM - DRIVE_RAMDISK To get a readable translation of this value, call the class DriveTypeToString method.
LogicalDrives Property Gets the drive letter of the specified logical drive
DriveLetterFromNumber Method Returns the drive letter for the specified logical drive number
DriveTypeToString Method Translates long integer drive type value to a readable string. Use the DriveType property in this class to get the long integer value of the drive type, then use this method to get a the readable form of the drive type.
GetDriveCount Method Returns the number of logical drives installed
GetDriveInfo Private Returns the requested information about the specified drive.
IsDriveReady Method Determines if the named drive is ready for access. The Windows API does not have a native method for determining if a drive is ready. This proc works by trying to get Volume information for the specified drive. It then checks the VBA Error object's LastDllError property which exposes the Windows GetLastError API function. If that value is not 0, we'll assume that the drive is not ready.
TrimNulls Private Returns the passed string terminated at the first null character
VolumeFlagsToString Method Translates long integer file system flags value to a readable string. Use the DriveFlags property of this class to get the long integer file system flags. Then pass the value to this method to get the readable form of the flags.
WriteVolumeLabel Method Sets the volume label for the specified disk. Use this method with caution. It physically changes the volume label for the specified disk.

Overview of Total Visual SourceBook

The source code in Total Visual SourceBook includes modules and classes for Microsoft Access, Visual Basic 6 (VB6), and Visual Basic for Applications (VBA) developers. Easily add this professionally written, tested, and documented royalty-free code into your applications to simplify your application development efforts.

Additional Resources

Feedback

Contact Us  l   Web questions: Webmaster   l   Copyright © FMS, Inc., Vienna, Virginia
Celebrating our 26th Year of Software Excellence