码迷,mamicode.com
首页 > 其他好文 > 详细

检索 COM 类工厂中 CLSID 为 {96749377-3391-11D2-9EE3-00C04F797396} 的组件失败,异常0x80040154,没有注册类问题分析和解决办法

时间:2015-02-07 10:22:12      阅读:871      评论:0      收藏:0      [点我收藏+]

标签:80040154 没有注册类 解决办法   tts 微软语音   

问题分析和解决

        //阅读函数
        private void Read(string text)
        {
            SpVoice sp = new SpVoice();//报错位置
            sp.Rate = GetSpeedSelected();
            SpeechVoiceSpeakFlags sFlags = SpeechVoiceSpeakFlags.SVSFlagsAsync;
            sp.Speak(text, sFlags);
        }


报错信息:

有关调用实时(JIT)调试而不是此对话框的详细信息,
请参见此消息的结尾。

************** 异常文本 **************
System.Runtime.InteropServices.COMException (0x80040154): 检索 COM 类工厂中 

CLSID 为 {96749377-3391-11D2-9EE3-00C04F797396} 的组件失败,原因是出现以下错误: 

80040154 没有注册类 (异常来自 HRESULT:0x80040154 (REGDB_E_CLASSNOTREG))。
   在 System.Runtime.Remoting.RemotingServices.AllocateUninitializedObject

(RuntimeType objectType)
   在 System.Runtime.Remoting.Activation.ActivationServices.CreateInstance

(RuntimeType serverType)
   在 System.Runtime.Remoting.Activation.ActivationServices.IsCurrentContextOK

(RuntimeType serverType, Object[] props, Boolean bNewObj)
   在 System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean 

publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal&

ctor, Boolean& bNeedSecurityCheck)
   在 System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean 

skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
   在 System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean 

skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
   在 System.Activator.CreateInstance(Type type, Boolean nonPublic)
   在 System.Activator.CreateInstance(Type type)
   在 SpeakDemo.Form1.Read(String text) 位置 c:\Users\Administrator\Desktop

\SpeakDemo\SpeakDemo\SpeakDemo\Form1.cs:行号 32
   在 SpeakDemo.Form1.btnRead_Click(Object sender, EventArgs e) 位置 c:\Users

\Administrator\Desktop\SpeakDemo\SpeakDemo\SpeakDemo\Form1.cs:行号 43
   在 System.Windows.Forms.Control.OnClick(EventArgs e)
   在 System.Windows.Forms.Button.OnClick(EventArgs e)
   在 System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   在 System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, 

Int32 clicks)
   在 System.Windows.Forms.Control.WndProc(Message& m)
   在 System.Windows.Forms.ButtonBase.WndProc(Message& m)
   在 System.Windows.Forms.Button.WndProc(Message& m)
   在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   在 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

解决办法:

如果方法一不能解决问题,可以尝试方法二。

方法一

检索 COM 类工厂中 CLSID 为 {XXXX-XXXX-XXX-XXXXX-XXX} 的组件时失败,原因是出现以下错误: 80040154。

如以上问题出现,多半是因为COM控件未在目标机器上面注册造成的
解决方法:
Regsvr32 .net中引用控件的名称
如果注册成功,问题不在出现

但是如果是在x64位的系统中,即使控件注册成功,错误依照提示,是因为大多数第三方写的COM控件,只支持32位的系统,

在VS中找到引用控件所在的项目--〉属性--〉生成--〉常规---〉目标平台---〉选择X86即可解决。

方法二

原因:有些GHOST版win 系统没有启动语音引擎 控制面板上没有 语音 这个选项

修复:打开“C:\Windows\Inf” 看有没有sapi5.inf 这个文件,如果没有网上下载,

下载地址:http://download.csdn.net/detail/wyx100/8430545

技术分享

 

技术分享

 

右键单击文件“sapi5.inf”,选择“安装”,提示“提示插入系统盘……”,没系统盘的话点“浏览”,从TTS解压的目录中选择需要的系统文件。

TTS下载地址:

http://download.csdn.net/detail/wyx100/8430545    xpTTS.zip

 

安装完成后,C:\Program Files\Common Files\microsoft shared\Speech 文件夹下

技术分享

 

安装完成后,可以运行SpeakDemo.exe进行测试,如果不成功,继续操作。

技术分享

技术分享

没有安装盘,把下载到的 [微软TTS5.1语音引擎(中文).msi]改名为微软TTS5.1语音引擎(中文).rar 用RAR解压,
改成提示中对应的文件名即可.
C:\Program Files\Common Files\Microsoft Shared\Speech\sapi.cpl
C:\Program Files\Common Files\SpeechEngines\Microsoft\Lexicon\1033\r1033tts.lxa
大功告成.

 

检索 COM 类工厂中 CLSID 为 {96749377-3391-11D2-9EE3-00C04F797396} 的组件失败,异常0x80040154,没有注册类问题分析和解决办法

标签:80040154 没有注册类 解决办法   tts 微软语音   

原文地址:http://blog.csdn.net/wyx100/article/details/43601041

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!