views:

126

answers:

2

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;
        }
    }
+1  A: 

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

Alan
thanks for ur help but im doing it first time i need ur help to use it..
zoya
Another option would be http://www.codeproject.com/KB/miscctrl/imapi2.aspx this is a good article
Alan
is this compatible to use in the winxp and .net2008
zoya
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
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.
Alan
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
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.
Alan
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
i appreciate the way u guided me..as im new to c# and this project..
zoya
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
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?
Alan
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
thanks for ur help..
zoya
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
Alan
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
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
http://www.gangleri.net/2010/03/02/BurningFilesToCDDVDWithCAndWindowsXP.aspx
zoya
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
also its taking XPburn as a method in my VS2008 not as a object..
zoya
just have a look on the code
zoya
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.
Alan
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
"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.
Alan
so what is the solution to burn it in XP..can u help me out plz??
zoya
i have tried ur sample code but its not working in VS2008..
zoya
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
+1  A: 

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
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