VBIO Visual Basic VBX for determining and setting Disk and File information. COPYRIGHT NOTICE / DISCLAIMER This control is copyrighted by A. Broeze, vbx_dev@shear.iaf.nl The VBIO.VBX control library is distributed "as is" and without warranties as to performance or merchantability or any other warranties whether expressed or implied. No warranty of fitness for a particular purpose is either expressed or implied. If you decide to use this control you do it entirely on your own risk. DISTRIBUTION INFORMATION This control is a simple one I've developed for my own purposes (it came in especially handy for my installation programs). Since I think it may be useful to you as well, I hereby grant you the right to use this control under two restrictions: 1. You may not charge any fees for this control if you distribute it with your applications 2. You'll have to mention my name in the copyrights section of your programs documentation. CONTROL INFORMATION This control allows you to set the volume-label, get total & free disk- space, get and set file-attributes etc. The VBIO vbx works with a 'current drive' and a 'current file'. You can set the current drive and current file using the 'Drive' and 'File' properties. Errors are reported in the 'Error' and 'ErrorMessage' properties. Following is a description of all properties and how to use them. Property Value Meaning Action 0 = Nothing 1 = Reread drive info Reread all drive related properties 2 = Reread file info Reread all file related properties 3 = Set volume label Set volume label of current drive 4 = Set file attributes Set file attributes of current file 5 = Set file date/time Drive 0 - 25 Set the 'current drive' File String Set the 'current file' File may include pathname IsCDROMDrive Boolean (read-only) True if current drive is a CD-ROM drive, False otherwise IsNetworkDrive Boolean (read-only) True if current drive is a networked or subst drive, False otherwise FreeDiskSpace Long integer (read-only) Free diskspace on current drive TotalDiskSpace Long integer (read-only) Total diskspace on current drive VolumeLabel Strings Volume label of current drive To change the volumelabel, assign another string to this property and set the action property to 3. FileSize Long integer (read-only) File size of current file FileDate String File-date of current file. To change it, assign another string to this property and set the action property to 5. See the ErrorMessage property for the DateFormat to use. FileTime String File-time of current file. To change it, assign another string to this property and set the action property to 5. See the ErrorMessage property for the TimeFormat to use. Archive Boolean File-attributes of the ReadOnly Boolean current file. To change the Hidden Boolean file-attributes of the current System Boolean file, change one or more of SubDir Boolean (read-only) these properties and set the Action property to 4. Error Integer (0-10) Reports the last error. Check the ErrorMessage property for a textual explanation of the error. ErrorMessage String The following table lists the possible values for the Error and ErrorMessage properties: Error ErrorMessage 0 No errors encountered 1 Drive not ready 2 Drive does not exist 3 File does not exist 4 Cannot set volume label of network or cd-rom drive 5 Error setting volume label 6 Error setting file-attributes 7 Unable to open file 8 Error setting file date/time 9 Invalid date format (must be mm/dd/yy) 10 Invalid time format (must be hh:mm:ss) EXPORTED FUNCTIONS The functionality of this VBX is also available via exported functions. Below is a list of exported functions that can be called from within any langauge: BOOL FAR PASCAL _export IsCDROMDrive(WORD wDrive); returns TRUE is 'wDrive' is a cd-rom drive wDrive = 0 - 25 (drive A: = 0, B: = 1 etc) BOOL FAR PASCAL _export IsNetworkDrive(WORD wDrive); returns TRUE if 'wDrive' is a network drive wDrive = 0 - 25 (drive A: = 0, B: = 1 etc) LONG FAR PASCAL _export DiskFree(WORD wDrive); reports free diskspace on drive 'wDrive' wDrive = 0 - 25 (drive A: = 0, B: = 1 etc) returns -1 on error LONG FAR PASCAL _export DiskSize(WORD wDrive); reports total diskspace on drive 'wDrive' wDrive = 0 - 25 (drive A: = 0, B: = 1 etc) returns -1 on error int FAR PASCAL _export GetFileAttributes(LPSTR szFileName); returns the file-attributes of the file pointed to by 'szFileName' returns -1 on error. int FAR PASCAL _export SetFileAttributes(LPSTR szFileName, int attrib); sets the file-attributes of the file pointed to by 'szFileName' to 'attrib'. Returns non-zero on success, zero on error. int FAR PASCAL _export GetVolumeLabel(WORD wDrive, LPSTR szLabel); retrieves the volume label of the drive 'wDrive' in 'szLabel' returns non-zero on success, zero on error. int FAR PASCAL _export SetVolumeLabel(WORD wDrive, LPSTR szLabel); sets the volume label of drive 'wDrive' to 'szLabel' returns zero on success, non-zero on error. -------------------------------------------------------------------------- Arjen Broeze vbx_dev@shear.iaf.nl 21/08/94