简体   繁体   English

使用c#将文件刻录到CD

[英]Burn files to CD using c#

I am writing a program that downloads images to the hard drive and then I want to burn the folders that those are all divided up into, on a cd. 我正在编写一个程序,将图像下载到硬盘驱动器,然后我想在CD上刻录那些全部分割成的文件夹。 I don't want to create and image to burn, I just want to take all those folders and files and burn them to disc just like they are on the hard drive. 我不想创建和映像刻录,我只想把所有这些文件夹和文件刻录到光盘,就像它们在硬盘上一样。 Anyone know of a way to do this in C#? 有人知道在C#中这样做的方法吗?

I am using Windows 7 and Visual Studio 2008. 我使用的是Windows 7和Visual Studio 2008。

IMAPI2 - version 2 of the IMAPI API - is native to Windows 7 and is the preferred interface. IMAPI2 - IMAPI API的第2版 - 是Windows 7的原生版本,是首选界面。

http://msdn.microsoft.com/en-us/library/windows/desktop/aa366457(v=vs.85).aspx http://msdn.microsoft.com/en-us/library/windows/desktop/aa366457(v=vs.85).aspx

There is no way to do this without calling API calls in to windows. 如果不在Windows中调用API调用,就无法做到这一点。 It appears to be done with COM calls( ICDBurn for XP, MAPI for Windows Vista or newer). 它似乎是通过COM调用完成的( ICDBurn for XP, MAPI for Windows Vista或更新版本)。 Here is a SO Question that can point you in the right direction in how to do it in C++. 这是一个SO问题 ,可以指出你在C ++中如何做到这一点的正确方向。

If you need assistance doing COM calls in C# feel free to open a new question on the issue you are having with that. 如果您需要协助在C#中进行COM调用,请随时针对您遇到的问题打开一个新问题。

As of Windows Vista you can use the IMAPI API. 从Windows Vista开始,您可以使用IMAPI API。 This API enables you to burn images to CD, DVD and Blu-ray. 此API使您可以将图像刻录到CD,DVD和蓝光。

More information about the Image Master API can of course be found on MSDN: 有关Image Master API的更多信息当然可以在MSDN上找到:

http://msdn.microsoft.com/en-us/library/aa366450(v=VS.85).aspx http://msdn.microsoft.com/en-us/library/aa366450(v=VS.85).aspx

Check out this CodeProject article which talks in detail about it: 查看此CodeProject文章,详细讲述了它:

Another third party library that can help is SharpRecorder . 可以提供帮助的另一个第三方库是SharpRecorder The code is hosted on Google. 该代码托管在Google上。 Take a look at is to see if it fits your requirements. 看一下是否符合您的要求。 If not, you can always access the code and see how it works and learn from it. 如果没有,您可以随时访问代码并查看其工作原理并从中学习。

There is a couple of ways to do this with C# and IMAP2 Here is an example on Code Project 使用C#和IMAP2有两种方法可以执行此操作。以下是代码项目的示例

Also there is another example here using c# 还有另一个例子, 这里使用c#

note: if you are doing this on 7 you will need this update 注意:如果您在7上执行此操作,则需要此更新

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM