Database4YoU

Home ] Up ] News ] Applications ] YU applications ]

 

 

 

TMCDDrive v 1.0

E-mailware ( freeware ) without the source!

I have made and published several freeware components so far, but there are so little feedback that I decided to make them "e-mailware"! Send me an e-mail and I will send you the component without the nug screen if you want to use it in your non commercial applications!

TMCDDrive is component which might be useful if your application has to deal width CD drive(s). I use it in my MP3 catalog application and it suits my needs. It is TComponent descendant (TFrmComponent) not allowed to be created more then once per form.

Properties Events Download Feedback

Description

TMCDDrive has few properties and methods which will serve the purpose in the most CD applications. Component supports multi drive PC configuration but you'll probably want to work with only one CD drive at a time.


Description  Events Download Feedback

Properties

CDDrives : TStrings; is a list of all available CD drives
ActiveCD : string; The drive path of CD-ROM you want to work with. Default is the first CD drive path. If there are several CD's on the user system, you can leave the user to choose from CDDrives which one will be used while in your apllication.
AudioCD : Boolean; Is the CD in the drive audio disk?
MediaPresent: Boolean; Is the media present at all?
VolumeName : String; Volume name .
SerialNumber: String; Serial number.
Identity: String; Each CD has it's own ID, similar but not the same, as serial number. One may find the purpose for this hex number !!!
ShowStatusMsg: Boolean; If you don't want the MCI status form to show and notify the user, set this property to false.

Public properties:

ActiveCDOnly: Boolean. If you set this property to false on the multi drive system, the component will fire an appropriate event for each CD drive, not only for the selected one. Default is true.
Enabled: Boolean. If you disable the component, CD events will not be fired. If your application does not (temporarily) work with CD, there is no need to catch these events at all. Default is true.
CDMediaPresent, CDVolumeName, CDSerialNumber and CDIdentity are public counterparts of the same (without CD prefix) published properties. They are all read-only array properties and you should pass the drive path (i.e.CDMediaPresent[ 'X:\'] ) to see if media in drive X:\ (other then active one) is present

Methods

DoorOpen, CDDoorOpen[DrivePath]
DoorClose, CDDoorClose[DrivePath]

If you want, you may open or close the door of active CD drive at will. The appropriate messages are sent by windows, not by these methods and the behavior is the same as the user has opened (or closed) the CD drive door manually.

One may want to open the door when application needs new CD or finishes the job with the inserted one. Also, when your application is about to close, it would be nice to close the doors, too.

All properties and methods work with ActiveCD path, selected by your application to work with. If you have more then one CD drive on the system, you may want to access any one of them through the same properties and methods prefixed width 'CD' and drive path (i.e.. CDPresent[X:\], CDDoorOpen[X:\]  etc.)

Description Properties  Download Feedback

Events

There are only two events! They are declared as:

TDeviceChangeEvent = procedure(Sender: TObject; DrivePath: String) of object;

OnCDInserted:TDeviceChangeEvent!
 
This event is fired whenever the CD drive closes the door with media in it!
Note, if you close the door without the media in it, the CD is NOT inserted and hence, there is not OnCDInserted event. You can check the Present property to see if there is a valid media in the drive.
 
OnCDEjected:TDeviceChangeEvent!

The CD drive had opened the door, with or without the media in the drive!
Windows generate two of these messages and the component generates two events whenever the CD drive door is opened. I don't know why is it so, but you don't have to bother about it at all, because your application is only notified twice that there is nothing to do until new CD comes again.
These two windows messages differs only in "Reserved" part of message record and "Reserved" means "Do not use!". Property Present is true in the first and False in the second event so one can distinguish OnBeforeEjected and OnAfterEjected event, but there is no way to prevent the CD from being ejected at last! I assume that this might be done and used to lock the CD drive but it is undocumented and I didn't need the feature so I did not investigated it further!


Description Properties Events  Feedback

Demo

Demo project is included in the archive! You don't have to install the component at all! Just open the demo project and run it. If you want, you can install it later at wish!

Whether you find the component interesting or not, I would appreciate your comments by e-mail. I gave you this component for free so, don't hesitate,  waste an e-mail with a few words!

Download  TMCDDriveDemo1.zip ~18 Kb

Source available on purchase Price: US $ 30.
Back to top

Copyright © 2001 Database4YoU                 Last modified: September 07, 2001