C# Microsoft Agent Control 2.0

By admin - Last updated: Wednesday, October 12, 2005 - Save & Share - Leave a Comment

(1) Adding the MS Agent COM component in your VS.NET toolbox by clicking Visual Studio menu Tools > Add/remove toolbox items > COM Components. Tick Microsoft Agent Control.

(2) The agent control will now be shown under the ‘components’ tab in the VS toolbox. If it is a windows form application, just drag and drop it to the form.

public class Form1 : System.Windows.Forms.Form
{
    private AxAgentObjects.AxAgent axAgent1;
    private AgentObjects.IAgentCtlCharacter speaker;
    try
    {
        this.axAgent1.Characters.Load("merlin" , "merlin.acs");
        this.speaker = this.axAgent1.Characters["merlin"];
        this.speaker.Show(null);
        this.speaker.MoveTo(800, 600, null);
        this.speaker.Play("Explain");
        this.speaker.Speak("Please speak this hello world", null);
    }
    catch
    {
       MessageBox.Show("Invalid");
    }



Posted in Code Notes • Tags: , , Top Of Page