最初,QuickTime OCX似乎可以短暂地工作。在visual中,我做了以下工作:
QuickTime Plugin Control将->添加到工具箱中,选择“工具箱项”-> COM Components ->选中“QuickTime插件控件”,好的。它展示了一个带有QuickTime标志的面板。然后,我进入了代码视图,并通过intellisense探索了一些属性和方法(我想用它自动化一些AAC编码)。
切换回designer视图后,Visual崩溃,从此我无法再工作任何东西。我已经从解决方案中删除了所有引用,并重新启动了Visual。尝试再次删除该控件并将其添加到工具箱中(该部分工作),但一旦我试图将其拖到窗体上,就会得到以下错误:
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:
regsvr32 "C:\Program Files (x86)\QuickTime\QTPlugin.ocx"结果:
DllRegisterServer in C:\Program Files (x86)\QuickTime\QTPlugin.ocx succeeded.重新尝试使用它,但没有运气,然后尝试如下:
regsvr32 /i "C:\Program Files (x86)\QuickTime\QTPlugin.ocx"结果:
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.不知道从这里往哪里走。它短暂的工作了,然后就坏了,怎么修理呢?
发布于 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。
https://stackoverflow.com/questions/22621360
复制相似问题