C#实现刻录功能

 今天在网上看到网友在讨论C#实现刻录功能,就关注了一下,主要有两种途径:1.XP Burn Componet的使用;

2.通过IMAPI 。下面是我搜集的相关资料。

 XP Burn Componet介绍(转载自:http://msdn.microsoft.com/en-us/vcsharp/aa336741.aspx

XP Burn Component

 

The XP Burn Component allows your .NET applications to burn files to CDR/W discs on a Window XP or Windows 2003 Server system. This component does not work for systems which have a different OS installed; though it will detect that case and give a reasonable error message. This component talks directly to the system’s IMAPI interfaces and doesn’t use the Windows XP CD burning wizard, so it’s possible to create your own snazzy UI for burning CDs.

Though the component is a UserControl, I wouldn’t recommend that you put it in the toolbox. Instead, simply reference it and use it like you would use any other framework type (the constructor can potentially throw exceptions, so for robust handling you should wrap it in a try…catch). The documentation and source for the component is included in the download.

You can download the component, developer documentation, and source. 

IMAPI 介绍

转载自:http://blogs.msdn.com/dhawan/archive/2009/11/17/introduction-to-imapi.aspx 

 

Introduction to IMAPI

In recent past, I have seen few question coming to me asking, “How do I write data on the CD/DVD disk programmatically?” . During my research, I have good introduction to the interfaces available on Windows for burning CD/DVD programmatically that I want to share with all.

There are two basic way to burn CD/DVD. One question can come pretty early, How does Windows OS in-built functionality works? On Windows XP onwards ( could not check on Windows 2000 or earlier, probably there is none ) we can burn the disc by dragging the files/folders on to the disc. OS does it with the shell interface ICDBurn Interface. If you want to burn the files/folders in your program you can use ICDBurn interface but before calling ICDBurn::Burn Method, you need to copy the files/folders in a specific location called CD Staging Area. Once your application selects the files/folders to be written in the CD/DVD and copied to the CD Staging area, calling ICDBurn::Burn Method will burn the CD/DVD, same as OS and delete the files from that location automatically. CD Staging area can be determined by the application by the information available in MSDN documentation as below --

The staging area has a default location of %userprofile%\Local Settings\Application Data\Microsoft\CD Burning. Its actual path can be retrieved through SHGetFolderPath, SHGetSpecialFolderPath, SHGetFolderLocation, SHGetSpecialFolderLocation, or SHGetFolderPathAndSubDir by using the CSIDL_CDBURN_AREA value.

Other way to burn CD/DVD is using Image Mastering API or IMAPI in short. IMAPI comes in two versions IMAPIv1 and IMAPIv2. IMAPIv1 is available for application to be used on Windows XP and Windows Server 2003 and IMAPIv2 is available on Windows Vista onwards, in-box. You can also get the IMAPIv2 available on Windows XP and Windows Server 2003 after installing a package, links and information are below--

What's New

IMAPI 2.0 is included in Windows Vista. Enabling the same functionality for Windows XP and Windows Server 2003 requires the installation of the KB932716 update package.

After installing Description of the Image Mastering API v2.0 (IMAPIv2.0) update package that is dated June 26, 2007 on Windows XP or  Windows Server 2003, application can use the interfaces exposed by IMAPIv2.

Note – Before burning any CD/DVD please see through documentation that which filesystem you want the IMAPI interfaces to be written on the disc? There are few options available like ISO9660, Joliet and UDF.

Next, few links to be shared for IMAPIv1 interfaces available.

IDiscMaster Interface

IDiscMaster::Open Method

IDiscMaster::RecordDisc Method

Next, few links to be shared for IMAPIv1 interfaces available.

IDiscMaster2 Interface

IDiscRecorder2 Interface

Also, IMAPIv2 has multisession support and interfaces are available.

Samples- While there are code snippet sample available on MSDN documentations of the interface/method, there are 2 complete sample applications available in Windows SDK for Vista ( onwards ). Sample locations

 are below after you install Windows SDK on the dev machine ---

%program files%\Microsoft SDKs\Windows\v6.0\Samples\WinBase\imapi\imapi2sample

%program files%\Microsoft SDKs\Windows\v6.0\Samples\WinBase\storage\IBurn

While imapi2sample is native code in C++, IBurn sample is managed in C#. Please refer to the samples for more understandings of the IMAPI, that can give good start if you want to develop a feature/application for CD/DVD burning.

 

Nitin Dhawan

Windows SDK – Microsoft

Published Tuesday, November 17, 2009 8:35 PM by Dhawan

 

 

(www.softgogo.com)该刻录光盘SDK简单易用,功能强大稳定,包括了DLL和OCX控件调用方式。专门用于刻录数据、音乐、VCD、SVCD、DVD影碟,支持实时刻录、实时DVD视频光盘录像、加密刻录等强大功能。支持现在市场上的所有光盘,包括CD,DVD,蓝光盘片,支持所有光盘的数据追加刻录,支持多台同时刻录,并且支持所有类型的刻录机。在Demo演示版本中提供了所有功能测试,您可以直接试用。 该SDK的售价包含了授权费用和使用费用,是一次性价格,没有其他任何的收费。使用该SDK发布的产品没有任何时间和数量的限制,无开发人员使用数量限制。 本SDK是标准的Windows动态连接库文件,可独立完成所有功能刻录底层不依赖其它的任何第3方的环境或者文件。能够轻松的被其它windows应用程序及开发工具调用,包括VB、VC、DELPHI、C#等。提供的用户接口友好且使用简单。本SDK编码质量优良,操作速度快,不会占用及耗费多余的临时硬盘空间,刻录所需要的数据操作全部在内存中完成,已经通过了以上提及的所有CD及DVD盘片测试,并且经过了大量的各种类型的刻录机的检验测试。 本SDK提供的主要接口函数功能有: ·得到盘片信息 ·搽除可搽写盘片 ·设置并得到当前盘片的读写速度 ·弹进弹出光盘托盘 ·得到光驱设备的型号及附带的产品信息 ·得到当前设备支持的写类型 ·刻录镜像文件(*.ISO及其他标准格式的镜像文件)到光盘 ·刻录文件及文件夹到光盘 ·追加刻录文件及文件夹到光盘(Multisession disc) ·刻录VCD/SVCD光盘 ·刻录DVD影碟 ·得到当前刻录进度 ·得到当前正在刻录的文件名 ·得到当前刻录过程中的错误信息 ·停止刻录进程。 ·刻录文件及文件夹到镜像文件(*.iso) ·刻录mp3或者wave文件到音乐光盘 ·得到mp3或者wave文件的文件信息 ·保存音乐光盘中的Audio Track为mp3或者wave文件 ·得到光盘的Track信息 ·复制CD/DVD盘片 ·支持ISO和UDF格式的数据光盘刻录 ·刻录自运行光盘(AutoRun) ·实时刻录 ·实时DVD光盘录像 ·加密刻录
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值