1 Attachment(s)
Burn CDs with the XP burning wizard
XP has the image mastering API (IMAPI) that lets you burn data CDs (not DVDs). Attached is a fixed version of the code I posted to a thread in the forum. It should burn twice in a row now as I've added a dispose method to release the com object.
Users need:
OS: Xp and above, probably not Vista though as it gets IMAPI2 (with DVD support, easy to use and extensible!)
A drive selected as the recorder drive (windows explorer -> drive properties -> recording tab -> Enable CD Recording on this drive).
How it works.
The ICDBurn interface is used to check the user has a cd recorder drive set up correctly.
The staging folder is determined with an api call. The user selects files and folders, and we copy them to the staging folder.
User clicks burn, ICDBurn.Burn is called, this starts the xp cd buning wizard which will guide the user through the burn.
Once done, we call dispose - this releases the com object and IMAPI.exe will close. We then delete the files in the staging area.
XP burning wizard crashes (but does not burn!)
The sample and my app crash with
Arithmetic operation resulted in an overflow.
at the line
Dim hresult As UInteger = m_iCDBurn.GetRecorderDriveLetter(driveLetter, 4)
in the burner.vb module
m_iCDBurn.GetRecorderDriveLetter(driveLetter, 4) is -2147418113
(VB 2005, XP SP2)