首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使QuickTime OCX控件正确注册并在.Net中工作

如何使QuickTime OCX控件正确注册并在.Net中工作
EN

Stack Overflow用户
提问于 2014-03-24 21:51:52
回答 1查看 1K关注 0票数 0

最初,QuickTime OCX似乎可以短暂地工作。在visual中,我做了以下工作:

  • 右键单击“工具”窗格中的QuickTime Plugin Control将->添加到工具箱中,选择“工具箱项”-> COM Components ->选中“QuickTime插件控件”,好的。
  • 将控件从工具箱拖到我的空窗体。

它展示了一个带有QuickTime标志的面板。然后,我进入了代码视图,并通过intellisense探索了一些属性和方法(我想用它自动化一些AAC编码)。

切换回designer视图后,Visual崩溃,从此我无法再工作任何东西。我已经从解决方案中删除了所有引用,并重新启动了Visual。尝试再次删除该控件并将其添加到工具箱中(该部分工作),但一旦我试图将其拖到窗体上,就会得到以下错误:

代码语言:javascript
复制
Failed to create component 'AxHost'.  The error message follows:
 'System.InvalidOperationException: Unable to initialize component.
   at System.Windows.Forms.AxHost.DepersistControl()
   at System.Windows.Forms.AxHost.ActivateAxControl()
   at System.Windows.Forms.AxHost.TransitionUpTo(Int32 state)
   at System.Windows.Forms.AxHost.CreateHandle()
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl()
   at System.Windows.Forms.Control.ControlCollection.Add(Control value)
   at System.Windows.Forms.Form.ControlCollection.Add(Control value)
   at System.Windows.Forms.Design.ParentControlDesigner.AddChildControl(Control newChild)
   at System.Windows.Forms.Design.ParentControlDesigner.AddControl(Control newChild, IDictionary defaultValues)
   at System.Windows.Forms.Design.ControlDesigner.InitializeNewComponent(IDictionary defaultValues)
   at System.Windows.Forms.Design.AxHostDesigner.InitializeNewComponent(IDictionary defaultValues)'

我也尝试过通过QuickTime Control Panel\All Control Panel Items\Programs and Features ->修复,但没有成功。

然后我尝试重新注册DLL:

代码语言:javascript
复制
regsvr32 "C:\Program Files (x86)\QuickTime\QTPlugin.ocx"

结果:

代码语言:javascript
复制
DllRegisterServer in C:\Program Files (x86)\QuickTime\QTPlugin.ocx succeeded.

重新尝试使用它,但没有运气,然后尝试如下:

代码语言:javascript
复制
regsvr32 /i "C:\Program Files (x86)\QuickTime\QTPlugin.ocx"

结果:

代码语言:javascript
复制
The module "C:\Program Files (x86)\QuickTime\QTPlugin.ocx" was loaded but the entry-point DllInstall was not found.
Make sure that "C:\Program Files (x86)\QuickTime\QTPlugin.ocx" is a valid DLL or OCX file and then try again.

不知道从这里往哪里走。它短暂的工作了,然后就坏了,怎么修理呢?

EN

回答 1

Stack Overflow用户

发布于 2016-03-28 22:11:30

除了最初的QuickTime OCX问题之外,我发现System.Windows.Forms.AxHost.DepersistControl()中的InvalidOperationException出现是因为ActiveX控件缺少IPersistStreamInit、IPersistStream或IPersistStorage接口。AxHost需要其中之一,所以请确保在创建ATL ActiveX控件时包括其中一个。

对于像我这样在WinForms中添加自定义ATL WinForms控件时遇到困难的人来说,这是一个答案。有关IPersist接口的更多详细信息,请查找MSDN。

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

https://stackoverflow.com/questions/22621360

复制
相关文章

相似问题

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