Import ActiveX Control-->M$ Agent Control.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, OleCtrls, AgentObjects_TLB;
type
TForm1 = class(TForm)
Agent1: TAgent;
GroupBox1: TGroupBox;
Button1: TButton;
Button2: TButton;
Button3: TButton;
GroupBox2: TGroupBox;
ListBox1: TListBox;
GroupBox3: TGroupBox;
Edit1: TEdit;
Button4: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
//Button1.Caption:='Connect'
procedure TForm1.Button1Click(Sender: TObject);
var
dd
levariant;
begin
with agent1.Charactersdo
begin
Load('mime','d:/office/office/saeko.acs');
Item['mime'].Show(dd);
item['mime'].LanguageID:=$409;
Item['mime'].Speak('Hello',dd);
end;
button2.enabled:=true;button3.Enabled:=true;button4.Enabled:=true;
button1.Enabled:=false;
end;
//Button2.Caption:='Get Animates Names'
procedure TForm1.Button2Click(Sender: TObject);
var
i,count:integer;
str:IagentCtlAnimationNames;
outer:string;
begin
listbox1.items.clear;
listbox1.items.add('Name:'+agent1.Characters.Item['mime'].Get_Name);
listbox1.Items.Add('Version:'+agent1.Characters.Item['mime'].Get_Version);
listbox1.Items.Add('Description:'+agent1.Characters.Item['mime'].Get_Description);
listbox1.Items.Add('Command Caption'+agent1.Characters.Item['mime'].Commands.Caption);
agent1.Characters.Item['mime'].AnimationNames.GetTypeInfoCount(count);
for i:=0 to countdo
begin
str:=agent1.Characters.Item['mime'].Get_AnimationNames;
str.GetTypeInfo(i,agent1.Characters.Item['mime'].Get_LanguageID,outer);
listbox1.Items.Add(outer);
end;
end;
//Button3.Captioin:='DisConnect'
procedure TForm1.Button3Click(Sender: TObject);
begin
agent1.Characters.Unload('mime');
button1.Enabled:=true;button2.Enabled:=false;button4.Enabled:=false;
end;
//Button4.Caption:='Speak'
procedure TForm1.Button4Click(Sender: TObject);
var
url
levariant;
begin
agent1.Characters.Item['mime'].Speak(edit1.text,url);
end;
procedure TForm1.FormCreate(Sender: TObject);
var
width,i:integer;
begin
width:=0;
for i:=0 to listbox1.Items.Count-1do
begin
if width<listbox1.Canvas.TextWidth(listbox1.items.strings
) then
width:=listbox1.Canvas.TextWidth(listbox1.items.strings);
end;
sendmessage(listbox1.handle,LB_SETHORIZONTALEXTENT,width+2,0);
end;
end.