|
|
本人测试的时候,以下程序,右键出来了,但右键功能却没有,正在找原因。
全部程序如下:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, OleCtrls, AgentObjects_TLB, StdCtrls, Buttons;
type
TForm1 = class(TForm)
myAgent: TAgent;
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure myAgentCommand(Sender: TObject;
const UserInput: IDispatch);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
merlin: IagentCtlCharacter; Request1: IagentCtlRequest;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
merlin.Commands.Add('1','Yes','',True,True);
merlin.Commands.Add('2','No','',True,True);
end;
procedure TForm1.myAgentCommand(Sender: TObject;
const UserInput: IDispatch);
begin
if IAgentCtlUserInput(UserInput).Name = '1' then begin
ShowMessage('Yes');
end
else if IAgentCtlUserInput(UserInput).Name = '2' then begin
ShowMessage('No');
end
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Request1 := myAgent.Characters.Load('merlin', 'merlin.acs' );
merlin := myAgent.Characters.Character( 'merlin' );
merlin.Show(0);
end;
end. |
|