我用
Merlin.Commands.Add('Delphi2','Run Delphi','Delphi2',True,True);
在agent上添加了一个右键菜单选项 Run Delphi
但是同时多了一个“打开声音命令窗口”选项
1、如何去掉“打开声音命令窗口”选项。
2、如何控制"Run Delphi"选项(agent的添加出来的右键菜单项)点击后打开form2?

解决方案 »

  1.   

    我翻了翻以前的问题
    其中INeedCa同志说:
     
    procedure TForm1.Button1Click(Sender: TObject);
    begin
      Genie.Commands.Add('1', 'Yes', '', True, True);
      Genie.Commands.Add('2', 'No', '', True, True);
    end;procedure TForm1.Agent1Command(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;我照做了,但是右键菜单有,但是还是不能响应动作ShowMessage,请大家再帮我看看哪,
    全部源代码如下:
    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, OleCtrls, AgentObjects_TLB, StdCtrls, Buttons;type
      TForm1 = class(TForm)
        myAgent: TAgent;
        Button1: TButton;
        procedure FormActivate(Sender: TObject);
        procedure Button1Click(Sender: TObject);
        procedure myAgentCommand(Sender: TObject;
      const UserInput: IDispatch);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;
      Peedy: IagentCtlCharacter; Request1,Request2: IagentCtlRequest; 
    implementation{$R *.dfm}procedure TForm1.FormActivate(Sender: TObject);
    begin
    Request1 := MyAgent.Characters.Load( 'Peedy', extractfilepath(application.exename)+'\rover.acs' );
    Peedy := MyAgent.Characters.Character('Peedy');
    peedy.Show(0)
    end;procedure TForm1.Button1Click(Sender: TObject);
    begin
    peedy.Commands.Add('1','Yes','',True,True);
      peedy.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;
    end.
      

  2.   

    whubhjt (带刀侍卫) :你是真高手,可惜你的问题我不会,我有一个简单的问题,能不能麻烦看一下.谢谢
    http://expert.csdn.net/Expert/topic/1245/1245005.xml?temp=.2996942
      

  3.   

    不可能吧。
    你跟一下是否进TForm1.myAgentCommand这个事件了。