引发了类型为'System.Windows.Forms.AxHost + InvalidActiveXStateException'的异常. [英] Exception of type 'System.Windows.Forms.AxHost+InvalidActiveXStateException' was thrown.

查看:78
本文介绍了引发了类型为'System.Windows.Forms.AxHost + InvalidActiveXStateException'的异常.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的朋友,

我正在使用Microsoft代理创建显示字符的用户界面,但是当我运行它时,出现以下异常.
抛出了''System.Windows.Forms.AxHost+InvalidActiveXStateException''类型的异常.

activeXagent.Characters.Load("Genie",(object)"D:\\ WINDOWS \\ msagent \\ chars \\ Genie.acs"); //这是我要接受的例外.

完整代码:

Hi Dear Friends,

I am using Microsoft agent to create user interfaces that display characters, but when i run it give me the following exception.
Exception of type ''System.Windows.Forms.AxHost+InvalidActiveXStateException'' was thrown.

activeXagent.Characters.Load("Genie", (object)"D:\\WINDOWS\\msagent\\chars\\Genie.acs"); // THIS PART I AM GETTING EXCEPTION.

COMPLETE CODE:

using AgentObjects;
namespace speechRecognizerTest1
{
    public partial class Form1 : Form
    {
        private AxAgentObjects.AxAgent activeXagent = new AxAgentObjects.AxAgent();
        private IAgentCtlCharacterEx Character;
        
        public Form1()
        {
            InitializeComponent();
            
        }
        protected void AxAgent_Command(object sender, AxAgentObjects._AgentEvents_CommandEvent e)
        {
            IAgentCtlUserInput ui;
            ui = (IAgentCtlUserInput)e.userInput;
            if (ui.Name == "Hello")
            {
                Character.Speak((object)"Hello. My name is Robby." +
                  " Pleased to meet you.", null);
                }
            if (ui.Name == "Goodbye")
            {
                Character.Speak((object)"It was nice talking to" +
                  " you. Goodbye.", null);

                Character.Play("Wave");
                Character.Play("Hide");
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {

            activeXagent.Characters.Load("Genie", (object)"D:\\WINDOWS\\msagent\\chars\\Genie.acs"); // THIS PART I AM GETTING EXCEPTION
              Character = activeXagent.Characters["Genie"];
            
              Character.LanguageID = 0x409;
              Character.Show(null);
              Character.Speak ("Welcome you sir VISIT www.onlinecsharpteach.netfirms.com", null);
              button1.Enabled = false;
              Character.Commands.Caption="helloword";
              Character.Commands.Add("Hello",
             (object)"Say Hello",  

             (object)"([say](hello | hi) | good (day | morning | evening))", 

             (object)true,  
             (object)true);

        }
    }
}


我使用了此链接教程:
创建Cool Agent用户界面 [


I used this link tutorial:
Creating Cool Agent User Interfaces[^]
Any help :Thank u

推荐答案

私有AxAgentObjects.AxAgent activeXagent = new AxAgentObjects.AxAgent();

在初始化部分中,我添加this.controls.add(control value)

private AxAgentObjects.AxAgent activeXagent = new AxAgentObjects.AxAgent();

in the intialization part i add the this.controls.add(control value)

public Form1()
       {
           InitializeComponent();
           this.Controls.Add(activeXagent);
       }


尝试将此文章发布在论坛中该文章的下面,作者可能会为您提供帮助.

造成此问题的最可能原因是尚未正确创建/初始化ActiveX控件.
Try posting this in the forum under that article, and the author may be able to help you.

The most likely cause of this problem is that the ActiveX control has not been properly created/initialized yet.


Abdullahomaid477


谢谢Abdulla,它在我的64位Windows 2008 RC2系统上像魔术一样工作


Thanks Abdulla , It worked like magic on my 64 bit Windows 2008 RC2 system


这篇关于引发了类型为'System.Windows.Forms.AxHost + InvalidActiveXStateException'的异常.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆