1

can any expert help me out to solve a problem of burning a dvd using c#.net as a front end?? i need to select files from the listview in winform and then on button click i need to burn those multiple files in the dvd.. the concept is to select the multiple files from listview then on button click it should make a folder in some desired drive.. and then it should burn that complete folder in the dvd..this whole process should be performed during a single button click.... is there any way out?? the code should be compatible to use in .net2008 and windowsXP are the given codes compatible??

im using the componenet to get the dll/class lib. from (msdn.microsoft.com/en-au/vcsharp/aa336741.aspx) but its giving me error message "there are no components in d:\filepath\burncomponent.dll to be placed on the toolbox

   private void button1_Click(object sender, EventArgs e)
    {
        XPBurnCD cd = new XPBurnCD();
        cd.BurnComplete += new NotifyCompletionStatus(BurnComplete);

        MessageBox.Show(cd.BurnerDrive);

        DirectoryInfo dir = new DirectoryInfo(_burnFolder);
        foreach (FileInfo file in dir.GetFiles())
        {
            cd.AddFile(file.FullName, file.Name);
        }

        cd.RecordDisc(false, false);


    }

    private void BurnComplete(uint status)
    {
        MessageBox.Show("Finished writing files to disc");
    }

    private void button2_Click_1(object sender, EventArgs e)
    {

        FolderBrowserDialog fbd = new FolderBrowserDialog();
        fbd.ShowNewFolderButton = false;
        fbd.Description = "Please select a folder";
        fbd.RootFolder = System.Environment.SpecialFolder.DesktopDirectory;

        if (fbd.ShowDialog() == DialogResult.OK)
        {
            _burnFolder = fbd.SelectedPath;
        }
        else
        {
            _burnFolder = string.Empty;
        }
    }
Iain Holder
  • 14,172
  • 10
  • 66
  • 86
zoya
  • 473
  • 4
  • 11
  • 21

2 Answers2

1

Check out http://msdn.microsoft.com/en-au/vcsharp/aa336741.aspx

  • Another option would be http://www.codeproject.com/KB/miscctrl/imapi2.aspx this is a good article –  Feb 26 '10 at 21:00
  • is this compatible to use in the winxp and .net2008 – zoya Mar 02 '10 at 06:18
  • thanks for the details...but i need to know are the downloads necessary for this application?? will the code not work directly in the windows XP sp2/sp3... – zoya Mar 02 '10 at 06:45
  • If you are looking to do this on Windows XP download XP Burn (http://msdn.microsoft.com/en-au/vcsharp/aa336741.aspx) this gives you a class library that you can use to write files to a cd/dvd. –  Mar 02 '10 at 09:10
  • thanks sir i have already installed it and will it help me out to perform operation in Windows XP 2002 with sp2?? how to use it in c#??do we need to add it in the program.cs?? – zoya Mar 02 '10 at 09:28
  • 1
    Hi Zoya, check out http://www.gangleri.net/2010/03/02/BurningFilesToCDDVDWithCAndWindowsXP.aspx this is a sample I knocked together that uses XPBurn and it works on WindowsXP SP3 so it should also work on SP2. –  Mar 02 '10 at 21:27
  • thanks sir...u have really done a greate job... i will try the code provided by u and get back to u if i get some queries regarding this... – zoya Mar 03 '10 at 05:09
  • sir can i burn the files placed in the listview...whats the procedure to do that?? like i have 5 files in the listview and i need to burn them together..i dont need to add files one by one..i just want to burn the files in the listview...how to do that?? – zoya Mar 03 '10 at 05:16
  • For each file in the list view simply call the AddFile() method you'll need to provide the path to the file. After calling the AddFile() method for each file in the list box you can then call RecordDisc() and this will burn all the files to the DVD. Can you make your code available and I'll get a look at it, make the changes and add comments to explain what I've done? –  Mar 03 '10 at 09:13
  • sir i tried what ur code by adding the component and adding the assembly reference but its giving me an unhandled excetion of type ______.dll error..occured in ___.dll component.. and in additional information no XP compatible CDR (which supports ofdata) on this system.......what is the conclusion for this..?? that – zoya Mar 03 '10 at 12:03
  • Not sure about this error can you post more of your code? I have tried my solution on a Windows XP virtual machine and had no problem, I currently don't have a physical machine that I can install XP onto –  Mar 03 '10 at 22:01
  • i have not added on my code i have just tried ur code ..that u have given me in the sample at gangleri.net/2010/03/02/… link.. – zoya Mar 04 '10 at 04:43
  • maybe my windows are not compatible..for this..as im havin XP windows version 2002..and with pentium(R) 4 CPU 3.00GHz..1.49GB RAM and now working in VS2008..so what do u think?? – zoya Mar 04 '10 at 04:47
  • sir i think my lower version of VS2008 is not supporting the higher version of VS2010..as ur application is in 2010...and the XPburn component.dll is not supporting the lower version..because in error it was given exception unhandeled of type XPburn.dll occured in XPburn.dll component..so i think we should look for the solution that will work in VS2008.net.... – zoya Mar 04 '10 at 05:23
  • Although my sample project is VS2010 the code was compiled to work with the .Net 3.5 framework, and the XPBurn dll should work with Visual Studio 2008 no problem it's just a class library. I'll make the same solution available as a VS2008 solution later that why you should at least be able to insert break points and debug the code. –  Mar 04 '10 at 08:56
  • sir i have tried the code given at http://www.codeproject.com/KB/miscctrl/imapi2.aspx using imapi.. but its giving me error recorder not supprted..?? what is that means?? – zoya Mar 09 '10 at 06:34
  • 1
    "Windows introduced the new IMAPIv2.0 with the release of the Vista Operating System" - This article works with Vista upwards, if you are using Windows XP this article will not work. –  Mar 09 '10 at 07:50
  • so what is the solution to burn it in XP..can u help me out plz?? – zoya Mar 11 '10 at 09:13
  • im getting the error in imapi after instaaling the win x86 advance features also...the unhandeled exception im getting is:- System.InvalidCastException: Unable to cast COM object of type 'IMAPI2.Interop.MsftFileSystemImageClass' to interface type 'IMAPI2.Interop.MsftFileSystemImage'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{7CFF842C-7E97-4807-8304-910DD8F7C051}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)). – zoya Mar 11 '10 at 10:14
1

One simple approach could be to use the command line tools dvdburn and cdburn, which are belonging to XP. For example take a look at this site.

Update

Yes, it is a console application, but you can start it within a .Net Application by using the Process class. And here you should especially take a deeper look into the StartInfo property and its members, cause here you can set the parameters or redirect the output into your program to get informations about what the program is doing.

Oliver
  • 43,366
  • 8
  • 94
  • 151
  • thanks sir but i need a c#.net code..not DOS cmd.. i need to burn files in a dvd using c# code.. im doing it for the first time please help me out – zoya Feb 26 '10 at 11:44