views:

115

answers:

2

I'm trying to burn DVD/CD through frontend C# code...

i have used IMAPI2 for buring CD/DVD in windows XP..but it is giving me unhandled exception... as:-

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

can anyone please help me out to solve this problem. I'm not able to solve this error. this project is working fine in Windows7 but unable to work with XP.

+1  A: 

IMAPI2 is distributed with Vista or higher, XP comes with IMAPI, in which DVDs aren't supported. You can download IMAPI2 for XP here.

On Freund
i have done that before but still the problem is not solved..
shruti
can u tell me why this error is coming???u can download the sample project from here:http: //www.codeproject.com/KB/miscctrl/imapi2.aspxand run this under the WindowsXP sp3 and if u r also getting the same eror then tell me the solution for this..
shruti
A: 

I'm interested in this because I'm starting a similar project. Anyway, it looks like the answer is at the page you linked to. Under the thread "BurnMedia application on XP SP3 not working ?", on page 2 of the comments, someone reports exactly the same error. Another poster states that he resolved it by changing:

[ComImport]
[CoClass(typeof(MsftFileSystemImageClass))]
[Guid("7CFF842C-7E97-4807-8304-910DD8F7C051")]
public interface MsftFileSystemImage : IFileSystemImage3, DFileSystemImage_Event
{
}

to

[ComImport]
[Guid("2C941FE1-975B-59BE-A960-9A2A262853A5")]
[CoClass(typeof(MsftFileSystemImageClass))]
public interface MsftFileSystemImage : IFileSystemImage, DFileSystemImage_Event
{
}

in one of the interop files.

However, on an even newer thread, the author suggests that this change (which reportedly works on Windows 7 and XP SP3) breaks Vista, and that he's working on a solution (as of a few days ago).

Ben M