CVolume

$Revision: 10 $

Description

This class makes it easy to handle volumes.

Data Members

None.

Methods

BOOL AutomaticallyEject( void )
Ejects the volume if it is not in use.
BOOL Close( void )
Closes the handle to the volume.
BOOL Dismount( void )
Dismounts the volume.
BOOL Eject( void )
OK, here's something useful. This method will call the other methods in the correct order and have the media spit out of the computer.
HANDLE GetHandle( void ) const
Gives you the handle to the volume so you can call the Win32 API yourself.
BOOL GetType( UINT& drive_type )
Tells you what type of volume you've opened. It will return one of the following (found in winioctl.h):
BOOL Load( void )
Loads the volume.
BOOL Lock( void )
Locks the volume.
BOOL Open( TCHAR drive_letter )
Opens a handle to the drive containing the volume.
BOOL PreventRemoval( BOOL prevent_removal = TRUE )
Tells NT whether or not you want to prevent the removal of the volume.
BOOL Unlock( void )
Unlocks the volume.

Example

#include <wfc.h>
#pragma hdrstop

void eject_zip_cartridge( TCHAR zip_drive_letter )
{
   WFCTRACEINIT( TEXT( "eject_zip_cartridge()" ) );

   CVolume zip_volume;

   if ( zip_volume.Open( zip_drive_letter ) != FALSE )
   {
      zip_volume.Eject();
   }
}

API's Used


Copyright, 2000, Samuel R. Blackburn
$Workfile: CVolume.cpp $
$Modtime: 6/26/01 10:53a $