Home > Language Reference > Classes

VFSVolume Class

  + Object
    + VFSVolume

Description

The VFSVolume class implements the functionality to manage expansion cards available on certain handheld device models with Palm OS® 4.0 or higher. This class is instantiable, derivable and cloneable.

Each expansion card inserted into the handheld device is given a unique volume reference number by the system which identifies the card on which to carry out operations such as opening and creating files. The FindFirstVolume and FindNextVolume methods list all the cards inserted into the handheld device and their volume references.

The following example populates a list with the names of all the available cards and stores the volume reference selected by the user in the iVolRef variable:

Private iVolRef as Integer

Private Sub Form_Load()
  Dim v as New VFSVolume
  Dim b as Boolean

  iVolRef = -1
  b = v.FindFirstVolume
  While b
    List1.AddItem v.Label, v.Reference
    b = v.FindNextVolume
  Wend
End Sub

Private Sub List1_Change()
  Dim k as Integer

  k = List1.ListIndex
  If k>=0 Then
    iVolRef = List1.ItemData(k)
  Else
    iVolRef = -1
  End If
End Sub

Once you have obtained a volume reference, you can start working with files stored on the card. You should instantiate a VFSVolume object, initialize its Reference property with a reference to a valid volume then use the file management functions. You can complete the previous example by adding a button that allows you to create a "/MyApp" directory on the selected card:

Private Sub Button1_Click()
  Dim v as New VFSVolume

  If iVolRef>=0 Then
    v.Reference = iVolRef
    v.CreateDirectory "/MyApp"
  Else
    MsgBox "Select a Volume"
  End If
End Sub

The VFSVolume object gives you all the necessary methods to manage directories and files in a volume. Refer to the list at the bottom of this page for further information. On the other hand, file access is provided using the StreamFile object.

See also Expansion cards and the VFSDemo sample.

Note: to use these functions on an Palm OS® emulator, you should obtain the driver "HostFS.prc", available to download from http://www.palmos.com/dev/tools/emulator. Refer to the Palm OS® Emulator documentation for instructions on installing and configuring this driver.

Members

MembersDescription
CreateDirectory Creates a directory.
DefaultDirectory Determine the default directory associated with a particular file extension.
Delete Deletes a file or directory.
FileSystem Indicates the file system used.
FindFirstFile Finds the first file or directory in a directory.
FindFirstVolume Finds the first available volume.
FindNextFile Continues listing the files started with FindFirstFile.
FindNextVolume Continues listing the volumes started with FindFirstVolume.
FreeBytes Available storage space on the volume.
Label Volume name.
MediaType Media type.
Reference Volume reference.
Rename Renames a file or directory.
TotalBytes Volume capacity.
Inherited from ObjectDescription
ClassID Returns the type identifier corresponding to the actual class of the object.
Implements Determines whether the object implements the features of a given class.
Iterate Event raised to iterate over the elements of a container object.
Recipient Recipient of events sent by the object.
Serialize Event raised to serialize the object content into a stream.

System requirements

SystemMinimal versionRemarks
Palm OSPalm OS 3.0Requires an expansion slot.