首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用IMAPI2.dll刻录CD/DVD

使用IMAPI2.dll刻录CD/DVD
EN

Stack Overflow用户
提问于 2011-04-04 11:59:30
回答 1查看 1.2K关注 0票数 1

我试图通过使用IMAPI2.dll在我的应用程序中添加刻录CD/DVD的工具。我正在使用Microsoft Visual FoxPro 9 SP 2开发。在调用这个方法时,它是IMAPI2.MsftDiscFormat2Data类(示例代码的最后一行)的一个成员,Visual给出了以下错误消息。Error Msg:"OLE错误代码0x80004002:不支持这种接口“

操作系统: Windows 7

请帮帮忙。

代码语言:javascript
复制
**--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)
EN

回答 1

Stack Overflow用户

发布于 2011-07-27 22:11:12

恐怕你在那儿运气不好。FoxPro在相当高的级别上与COM对象交互。实际上,它的工作方式与VBScript与COM的交互方式非常相似。通常,如果您的代码在VBScript中工作,它也将在FoxPro中工作。

这实际上是某些ActiveX/COM库中常见的问题。虽然impi2.dll和imapi2fs.dll中实现的对象都使用IDispatch --这是COM接口的最高级别和最可互操作的形式--但这些对象的一些方法参数、方法返回和属性不是IDispatch。

具体来说,ImageStream属性返回一个名为IStream的东西,它继承自IUnknown而不是IDispatch。因此,ImageStream属性返回一些FoxPro不知道如何处理的内容。FoxPro知道它是一个COM接口,但它不知道如何查找或调用该对象上的方法。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/5538126

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档