Using Microsoft Agent in C#

Author M M Harinath

Before starting to code, you will need the Microsoft Agent Control installed. Next, you have to download the characters. There are four type of characters are available for download. They are

Genie Merlin Peedy Robby
1.6 MB exe 1.8 MB exe 3.3 MB exe 2.2 MB exe

In this Code, I am going to use Genie character in Microsoft Agent Control.

Step 1

Create a new Visual C# Project -- Windows Application

Step 2

Right click on Toolbox, select Customize Toolbox Option, select Microsoft Agent Control 2.0 from the Com Component List, click on Select button and press Ok button to add the control to your project.

Step 3

Drag Microsoft Agent Control from Toolbox and drop it in your project and also Place two buttons in your form to activate Speak and Think Methods of the Microsoft Agent Character.

Step 4

Declare a global AgentObjects.IAgentCtlCharacterEx type variable called genie with Public modifier

public AgentObjects.IAgentCtlCharacterEx genie;

Step 5

In the Form Load event, Write the following code to load genie character and assign the character to a variable called Genie.

axAgent1.Characters.Load("Genie","Genie.acs");
genie=axAgent1.Characters["Genie"];

Step 6

Write the following code in Button1 click event to trigger speak Method of Character.

genie.Show(false);
genie.Speak("Test Message","");
genie.Hide(true);

Step 7

Write the following code in Button2 click event to trigger Think Method of Character.

genie.Show(false);
genie.Think("Test Message");
genie.Hide(true);


Genie think

 

 

You can also use Left and Top property of the character to set the position.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值