找回密码
 立即注册
查看: 1892|回复: 0

ms agent 中添加右键菜单并且执行

[复制链接]

6806

主题

10

回帖

2万

积分

管理员

积分
21879
发表于 2019-5-20 21:50:47 | 显示全部楼层 |阅读模式
本人测试的时候,以下程序,右键出来了,但右键功能却没有,正在找原因。

全部程序如下:

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.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表