TCDBurner

What is it?

The TCDBurner component allows Delphi6 to burn files to CDR/W discs on your Windows XP® system.  This component will NOT work on systems other than Windows XP systems (although it gives a nice error message back to your program).

Essentially, it is a nice, Delphi-friendly wrapper around the XP CD-Writing wizard.

Download

  www.ericlawrence.com/bayden/xpburn

To install, simply copy CDBurner.DCU and CDBurner.DCR to a convenient place (e.g. \Delphi\LIB) and then choose the Component | Install Component menu option in Delphi.

License

I haven't decided yet.  Either it's going to be completely free with source (after registration), or I may charge ~$5 for the source code.

Registration:  To remove a simple messagebox ("This component is unregistered") you must email me your name, your country, and what sort of program you'll be using this component in (with URL if possible).  Unless you request that I do not, I will highlight those tools using this component here.

If you'd like to donate to keep things moving, it's painless. Just click here.

Feedback and Future Enhancements

Depending on community interest, I will most likely improve the helper functions.  I'll also eventually write a demo app to show how the unit works.

Also, while XP's Wizard is nice, it might be cool to go around it and write directly to the disc, eh?  There are components out there now (~$300) which do that.  If there were enough interest, I could probably wirte a low-cost one ($25 or so).  But maybe the Wizard approach is good enough?

Bugs

    None known.  Yet

Developer's Guide

type TCDBurner = class(TComponent)
 

Major Functions

constructor Create(AOwner: TComponent); Pass a TForm in as the owner.  If you need a non-visual version, register, and we'll talk.
procedure StartBurn; First, copy any files specified with Add File or Add Folder to the staging area. 

Then burn the files in Windows XP's staging area to the disc.  If you'd like to automate this even further, use SendKeys to send a "NEXT" command to the Wizard Window

  

Read Only Properties

property LastError: String String containing the last error message generated by the component.
property Equipped: Boolean TRUE if system has WindowsXP and a compatible CD burner, FALSE otherwise.
property IsBurning: Boolean TRUE if the WindowsXP burn-wizard is currently active.
property BurnerDrive: String CDR path to which the files are burned; e.g. "D:\"
property BurnArea: String Local path of CD-burn staging area.  Usually %HOMEPATH%\Local Settings\Application Data\Microsoft\CD Burning

 

property FilesToBurn: TStringList read fFiles; String list containing the files you've added via Add Files and Add Folders method.
property BurnSize: Int64 read GetBurnSize; Size in bytes of files waiting to be burned.  Check this is below the size of a blank CD (650mb) before calling StartBurn.

  

Event Handler Properties

Type TBurnDoneEvent = procedure (iResult: Integer) of Object;

property OnBurnDone: TBurnDoneEvent; Assign an event handler to this

Returns 0 if the XP Burn wizard exited normally; Non-zero otherwise.  If nonzero, check LastError for more information, if available.

 
Helper Functions

These basic helper functions were added for those who don't want to deal with the file system on their own.  They may be updated to be more useful in future versions, if I get lots of registrations. ;-)

function AddFile(Filename: String): Boolean; Copy a file to the staging area.  Returns TRUE if added successfully.
function AddFolder(Path: String): Boolean; Copy all files in and beneath the given Path to the staging area.  Returns TRUE if added successfully.
function ClearFiles:Boolean; Delete all files in the staging area.  Returns TRUE if all files and folders were removed successfully.

WARNING:  This method will delete all files & folders in the staging area, including those that were already there.  Do not use this method carelessly, or you're going to have angry customers.