我想通过使用IMAPI2.dll来添加设备以将CD/DVD刻录到我的应用程序中。我正在使用Microsoft Visual FoxPro 9 SP 2来发掘。当我使用作为IMAPI2.MsftDiscFormat2Data类(示例代码的最后一行)成员的Write()方法时,Visual FoxPro会提供以下错误消息。错误消息:“OLE错误代码0x80004002:不支持此类接口。”使用IMAPI2.dll刻录CD/DVD
操作系统:Windows 7
请帮助。
**--Creating MsftDiscMaster2 object to connect to optical drives.
loDiscMaster = CREATEOBJECT("IMAPI2.MsftDiscMaster2")
**--Creating MsftDiscRecorder2 object for the specified burning device.
loRecorder = CREATEOBJECT("IMAPI2.MsftDiscRecorder2")
lcUniqueId = loDiscMaster.ITEM(0)
loRecorder.InitializeDiscRecorder(lcUniqueId)
**--Create an image stream for the specified directory.
loFileSystem = CREATEOBJECT("IMAPI2FS.MsftFileSystemImage")
loRootDir = loFileSystem.Root
**--Create the new disc format and set the recorder.
loDataWriter = CREATEOBJECT("IMAPI2.MsftDiscFormat2Data")
loDataWriter.Recorder = loRecorder
loDataWriter.ClientName = "IMAPIv2 TEST"
loFileSystem.ChooseImageDefaults(loRecorder)
**--Add the directory and its contents to the file system.
loRootDir.AddTree("F:\VSS",.F.)
**--Create an image from the file system
loResultImage = loFileSystem.CreateResultImage()
loStream = loResultImage.ImageStream
**--Write stream to disc using the specified recorder.
loDataWriter.Write(loStream)