用什么方式可以建立MSAGENT的对话泡泡(balloon)?
像Office中小助手的提问、搜索、提示等?(问题解决,另贴再付100)下面有一段是VB的:
With balBalloon
   .Button = msoButtonSetNone
   .Heading = "Balloon Object Example One"
   .Text = "Select one of the following " _
      & .Labels.Count & " options:"
   .Labels(1).Text = "VBA is a powerful programming language."
   .Labels(2).Text = "Office is a great development environment."
   .Labels(3).Text = "The Assistant is cool!"
   .Labels(4).Text = "Balloon objects are easy to use."   ' Show the balloon.
   intRetVal = .Show   ' Save the selection made by the user.
   If intRetVal > 0 Then
      strChoice = "{cf 4}" & .Labels(intRetVal).Text & "{cf 0}"
   Else
      strChoice = ""
   End If
End WithSet balBalloon = Assistant.NewBalloon
With balBalloon
   .Text = "You selected option " & CStr(intRetVal) & ": '" _
      & strChoice & "'"
   .Show
End With********With balBalloon
   .Button = msoButtonSetOK
   .Heading = "Balloon Object Example Two"
   .Text = "How many of the following " _
      & .Checkboxes.Count & " statements do you agree with?"
   .Checkboxes(1).Text = "VBA is a powerful programming language."
   .Checkboxes(2).Text = "Office is a great development environment."
   .Checkboxes(3).Text = "The Assistant is cool!"
   .Checkboxes(4).Text = "Balloon objects are easy to use."
   ' Save the selection made by the user.
   intRetVal = .Show
   ' Construct the string to display to the user based on the
   ' user's selections.
   For Each chkBox In .Checkboxes
      If chkBox.Checked = True Then
         strChoice = strChoice & "{cf 4}" & chkBox.Text & "{cf 0}" & "' and '"
      End If
   Next chkBox
   ' Remove the trailing "' and '" from strChoice.
   If Len(strChoice) <> 0 Then
      strChoice = Left(strChoice, Len(strChoice) - 7)
   End If
End With' Create new Balloon object and display the user's choices.
Set balBalloon = Assistant.NewBalloon
With balBalloon
   If intRetVal > 0 Or Len(strChoice) > 0 Then
      .Text = "You selected '" & strChoice & "'."
   Else
      .Text = "You didn't make a selection."
   End If
   .Show
End With

解决方案 »

  1.   

    没做过,但帮你
    Uppppppp!!!!!;
      

  2.   


    系统自带的帮助!The MessageBox function creates, displays, and operates a message box. The message box contains an application-defined message and title, plus any combination of predefined icons and push buttons. int MessageBox(    HWND hWnd, // handle of owner window
        LPCTSTR lpText, // address of text in message box
        LPCTSTR lpCaption, // address of title of message box  
        UINT uType  // style of message box
       );
     ParametershWndIdentifies the owner window of the message box to be created. If this parameter is NULL, the message box has no owner window. lpTextPoints to a null-terminated string containing the message to be displayed. lpCaptionPoints to a null-terminated string used for the dialog box title. If this parameter is NULL, the default title Error is used. uTypeSpecifies a set of bit flags that determine the contents and behavior of the dialog box. This parameter can be a combination of flags from the following groups of flags. 
    Specify one of the following flags to indicate the buttons contained in the message box:Flag Meaning
    MB_ABORTRETRYIGNORE The message box contains three push buttons: Abort, Retry, and Ignore.
    MB_OK The message box contains one push button: OK. This is the default.
    MB_OKCANCEL The message box contains two push buttons: OK and Cancel.
    MB_RETRYCANCEL The message box contains two push buttons: Retry and Cancel.
    MB_YESNO The message box contains two push buttons: Yes and No.
    MB_YESNOCANCEL The message box contains three push buttons: Yes, No, and Cancel.
     Specify one of the following flags to display an icon in the message box:Flag Meaning
    MB_ICONEXCLAMATION, 
    MB_ICONWARNING
    An exclamation-point icon appears in the message box.
    MB_ICONINFORMATION, MB_ICONASTERISK
    An icon consisting of a lowercase letter i in a circle appears in the message box.
    MB_ICONQUESTION A question- icon appears in the message box.
    MB_ICONSTOP, 
    MB_ICONERROR, 
    MB_ICONHAND
    A stop-sign icon appears in the message box.
     Specify one of the following flags to indicate the default button:Flag Meaning
    MB_DEFBUTTON1 The first button is the default button. MB_DEFBUTTON1 is the default unless MB_DEFBUTTON2, MB_DEFBUTTON3, or MB_DEFBUTTON4 is specified.
    MB_DEFBUTTON2 The second button is the default button.
    MB_DEFBUTTON3 The third button is the default button.
    MB_DEFBUTTON4 The fourth button is the default button.
     Specify one of the following flags to indicate the modality of the dialog box:Flag Meaning
    MB_APPLMODAL The user must respond to the message box before continuing work in the window identified by the hWnd parameter. However, the user can move to the windows of other applications and work in those windows. Depending on the hierarchy of windows in the application, the user may be able to move to other windows within the application. All child windows of the parent of the message box are automatically disabled, but popup windows are not.MB_APPLMODAL is the default if neither MB_SYSTEMMODAL nor MB_TASKMODAL is specified.
    MB_SYSTEMMODAL Same as MB_APPLMODAL except that the message box has the WS_EX_TOPMOST style. Use system-modal message boxes to notify the user of serious, potentially damaging errors that require immediate attention (for example, running out of memory). This flag has no effect on the user's ability to interact with windows other than those associated with hWnd.
    MB_TASKMODAL Same as MB_APPLMODAL except that all the top-level windows belonging to the current task are disabled if the hWnd parameter is NULL. Use this flag when the calling application or library does not have a window handle available but still needs to prevent input to other windows in the current application without suspending other applications.
     In addition, you can specify the following flags: MB_DEFAULT_DESKTOP_ONLYThe desktop currently receiving input must be a default desktop; otherwise, the function fails. A default desktop is one an application runs on after the user has logged on.MB_HELPAdds a Help button to the message box. Choosing the Help button or pressing F1 generates a Help event.MB_RIGHTThe text is right-justified.MB_RTLREADINGDisplays message and caption text using right-to-left reading order on Hebrew and Arabic systems. MB_SETFOREGROUNDThe message box becomes the foreground window. Internally, Windows calls the SetForegroundWindow function for the message box.MB_TOPMOSTThe message box is created with the WS_EX_TOPMOST window style.MB_SERVICE_NOTIFICATIONWindows NT only: The caller is a service notifying the user of an event. The function displays a message box on the current active desktop, even if there is no user logged on to the computer.
    If this flag is set, the hWnd parameter must be NULL. This is so the message box can appear on a desktop other than the desktop corresponding to the hWnd.
    For Windows NT version 4.0, the value of MB_SERVICE_NOTIFICATION has changed. See WINUSER.H for the old and new values. Windows NT 4.0 provides backward compatibility for pre-existing services by mapping the old value to the new value in the implementation of MessageBox and MessageBoxEx. This mapping is only done for executables that have a version number, as set by the linker, less than 4.0.To build a service that uses MB_SERVICE_NOTIFICATION, and can run on both Windows NT 3.x and Windows NT 4.0, you have two choices.1. At link-time, specify a version number less than 4.0; or
    2. At link-time, specify version 4.0. At run-time, use the GetVersionEx function to check the system version. Then when running on Windows NT 3.x, use MB_SERVICE_NOTIFICATION_NT3X; and on Windows NT 4.0, use MB_SERVICE_NOTIFICATION. 
     MB_SERVICE_NOTIFICATION_NT3XWindows NT only: This value corresponds to the value defined for MB_SERVICE_NOTIFICATION for Windows NT version 3.51. Return ValuesThe return value is zero if there is not enough memory to create the message box.
    If the function succeeds, the return value is one of the following menu-item values returned by the dialog box: Value Meaning
    IDABORT Abort button was selected.
    IDCANCEL Cancel button was selected.
    IDIGNORE Ignore button was selected.
    IDNO No button was selected.
    IDOK OK button was selected.
    IDRETRY Retry button was selected.
    IDYES Yes button was selected.
     If a message box has a Cancel button, the function returns the IDCANCEL value if either the ESC key is pressed or the Cancel button is selected. If the message box has no Cancel button, pressing ESC has no effect. ResWhen you use a system-modal message box to indicate that the system is low on memory, the strings pointed to by the lpText and lpCaption parameters should not be taken from a resource file, because an attempt to load the resource may fail. 
    When an application calls MessageBox and specifies the MB_ICONHAND and MB_SYSTEMMODAL flags for the uType parameter, Windows displays the resulting message box regardless of available memory. When these flags are specified, Windows limits the length of the message box text to three lines. Windows does not automatically break the lines to fit in the message box, however, so the message string must contain carriage returns to break the lines at the appropriate places. If you create a message box while a dialog box is present, use the handle of the dialog box as the hWnd parameter. The hWnd parameter should not identify a child window, such as a control in a dialog box. 
      

  3.   

    这个与Agent的应用很难组合到一起
      

  4.   

    这是实例!
    Application.MessageBox('asdf','adsf',MB_ICONEXCLAMATION);
    Specify one of the following flags to display an icon in the message box:
    下面的每一个标志都将显示一个图标在对话框窗体上;Flag Meaning
    MB_ICONEXCLAMATION, 
    MB_ICONWARNING
    An exclamation-point icon appears in the message box.
    MB_ICONINFORMATION, MB_ICONASTERISK
    An icon consisting of a lowercase letter i in a circle appears in the message box.
    MB_ICONQUESTION A question- icon appears in the message box.
    MB_ICONSTOP, 
    MB_ICONERROR, 
      

  5.   

    看错问题了,你说的是Agent编程,我给你源码!
    unit AgentUnit;{  Acknowledge 承认 LookDown 向下看 Sad 悲伤 
      Alert 警告 LookDownBlink 向下看眨眼 Search 寻找
      Announce 声明 LookUp 向上看 StartListening 开始聆听
      Blink 眨眼 LookUpBlink 向下看眨眼 StopListening 停止聆听
      Confused 迷惑 LookLeft 向左看 Suggest 建议
      Congratulate 祝贺 LookLeftBlink 向左看眨眼 Surprised 吃惊
      Decline 拒绝 LookRight 向右看 Think 思考
      DontRecognize 不承认 LookRightBlink 向右看眨眼 Wave 挥动
      Explain 解释 MoveDown 向下移动 Write 书写
      GestureDown 向下姿势 MoveUp 向上移动 Processing 计算……
      GestureUp 向上姿势 MoveRight 向右移动 Reading 阅读……
      GestureLeft 向左姿势 MoveLeft 向左移动 Searching 寻找……
      GestureRight 向右姿势 Pleased 高兴 Writing 书写……
      GetAttention 获得注意 Read 阅读 Greet
      问候 RestPose 恢复初始状态
    }interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, OleCtrls, AgentObjects_TLB, StdCtrls;type
      TForm1 = class(TForm)
        MyAgent: TAgent;
        Button1: TButton;
        Button2: TButton;
        Button3: TButton;
        Button4: TButton;
        Button5: TButton;
        Button6: TButton;
        Button7: TButton;
        Button8: TButton;
        Button9: TButton;
        Button10: TButton;
        procedure Button1Click(Sender: TObject);
        procedure Button2Click(Sender: TObject);
        procedure Button3Click(Sender: TObject);
        procedure Button4Click(Sender: TObject);
        procedure Button5Click(Sender: TObject);
        procedure Button6Click(Sender: TObject);
        procedure Button7Click(Sender: TObject);
        procedure Button8Click(Sender: TObject);
        procedure Button9Click(Sender: TObject);
        procedure FormCreate(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
       // Var
            merlin: IagentCtlCharacterEx;
            Request1,Request2: IagentCtlRequest;
      end;var
      Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
    begin
        MyAgent.Characters.Load( 'Peedy','C:\\WINNT\\msagent\\chars\\merlin.acs' );end;procedure TForm1.Button2Click(Sender: TObject);
    begin
        MyAgent.Characters.Item['Peedy'].Play('search');
    end;procedure TForm1.Button3Click(Sender: TObject);
    var
      aa : OleVariant;
    begin
       aa := 0;
       MyAgent.Characters.Item['Peedy'].Show(aa);
    end;procedure TForm1.Button4Click(Sender: TObject);
    begin
       MyAgent.Characters.Item['Peedy'].Play('LookUp');
    end;procedure TForm1.Button5Click(Sender: TObject);
    begin
        MyAgent.Characters.Item['Peedy'].Play('Acknowledge');
    end;procedure TForm1.Button6Click(Sender: TObject);
    begin
        MyAgent.Characters.Item['Peedy'].Play('Sad');
    end;procedure TForm1.Button7Click(Sender: TObject);
    begin
       MyAgent.Characters.Item['Peedy'].Play('LookDownBlink');
    end;procedure TForm1.Button8Click(Sender: TObject);
    begin
       MyAgent.Characters.Item['Peedy'].Play('Greet');
    end;procedure TForm1.Button9Click(Sender: TObject);
    var
       txt,url:OleVariant;
    begin
      txt := 'Windows 登录音';
      url := 'f:\123.wav';
      MyAgent.Characters.Item['Peedy'].Speak(txt,url);
    end;procedure TForm1.FormCreate(Sender: TObject);
    beginend;end.
      

  6.   

    先多谢你,我想知道的是出现可以选择的泡泡,就像一打开Office时出现的要选择“了解助手”、“升级信息”、“开始使用”的那种可以选择几个命令的形式。
      

  7.   

    MSDN上的:(VB)
    With Assistant.NewBalloon
        .Button = msoButtonSetOkCancel
        .Heading = "Regional Sales Data"
        .Text = "Select a region"
        For i = 1 To 3
            .CheckBoxes(i).Text = "Region " & i
        Next
        .Show
    End With但是Delphi中无法取得Balloon,但是有OnBalloonShow和OnBalloonHide事件,怎样才打得开泡泡???晕~~~
      

  8.   

    如果用ole方式:
    var
      aa:Variant;
    begin
      aa:=CreateOleObject(??????');
    字串应该写什么才行啊?
      

  9.   

    MS Agent是微软提供的一个动画人物编写方案!一般在Delphi中以单元文件形式提供给开发者,然后你就可以调用对应动画人物的相关动作来是界面人性化了.......相关实现方法可以去Google查查,很多.....动画人物资源可以去www.msagent.org的agentring去看看,那里提供了很多很可爱的动画人物..........
      

  10.   

    查了很多资料,我现在都开始怀疑Office中助手用的对话框是不属于Agent的了:(
    我想该把些类些的控件来模拟还简单些……
      

  11.   

    用MSAgent开发包,绝对是真的。
      

  12.   

    不是吧,这种问题我看写什么代码都没有用处,Google里面可以查出很多关于MSAgent的编程介绍啊!用控件?不麻烦了吧,而且那需要很高的技术,我可是没有那种技术!
      

  13.   

    晕,都结贴了啊,来晚了。
    var
     merlin:iagentctlcharacter;
    begin
     merlin.Speak('HELLO,WELCOME!','');
    end;其他部分我就不写了哈。