Platform SDK: Agent |
To access the Microsoft Agent services from a Web page, use the HTML <OBJECT> tag within the <HEAD> or <BODY> element of the page, specifying the Microsoft CLSID (class identifier) for the control. In addition, use a CODEBASE parameter to specify the location of the Microsoft Agent installation file and its version number.
If Microsoft Internet Explorer (version 3.02 or later) is installed on the system, but Microsoft Agent is not yet installed and the user accesses a Web page that has the <OBJECT> tag with the Agent CLSID, the browser will automatically attempt to download Agent from the Microsoft Web site. Then, the user will be asked whether to proceed with installation. For other browsers, contact the supplier for information regarding their support or third-party support for ActiveX controls.
The following example illustrates how to use the CODEBASE parameter to autodownload the English language version 2.0 of Microsoft Agent. For information about the current location of the Microsoft Agent installation file for specific language versions and the current release number available, see the Microsoft Agent Downloads for Developers page.
<OBJECT classid="clsid: D45FD31B-5C6E-11D1-9EC1-00C04FD7081F" CODEBASE = "#VERSION=2,0,0,0" id=Agent > </OBJECT>
Subject to a valid Microsoft Agent distribution license, Agent can also be installed from your own HTTP server or as part of an application's installation process. To support installation from your own HTTP server, you need to post the Microsoft Agent self-installing cabinet .Exe file and specify its URL in the CODEBASE tag.
<OBJECT classid="clsid: D45FD31B-5C6E-11D1-9EC1-00C04FD7081F" CODEBASE = "http://your server/msagent.exe#VERSION=2,0,0,0" id=Agent > </OBJECT>
To obtain Agent's self-installing cabinet file from the Microsoft Agent Web site, simply download the Agent file, and chose the browser's Save option. This should save the file to your specified location.
To support automatic download of a Microsoft Agent language component from a Web page, include the language component's Object tag on the page before the Agent control Object tag:
<OBJECT width=0 height=0 CLASSID="CLSID: C348XXXX-A7F8-11D1-AA75-00C04FA34D72" CODEBASE = "#VERSION=2,0,0,0"> </OBJECT>
where XXXX is replaced with a Language ID. For the languages currently supported, check the Microsoft Agent Web site.
To support other language versions of Agent, you use another Object tag specifying the language component. However, be aware that attempting to install multiple languages at the same time may require the user to reboot. The Agent language components can be obtained from the Agent Web site using the same procedure as for the Agent core component. Distribution licensing for the language components are covered in the standard Agent distribution license.To begin using a character, you must load the character using the Load method. A character can be loaded from the user's local storage or an HTTP server. For more information about the syntax for loading a character, see the Load method. Once the character has been successful loaded you can use the methods, properties, and events exposed by the Agent control to program the character. You can also use the methods, properties, and events exposed by your programming language and the browser to program the character; for example, to program its reaction to a button click. Consult the documentation for your browser to determine what features it exposes in its scripting model. For Microsoft Internet Explorer, see the Scripting Object Model, which is available in the ActiveX SDK.
Agent's services remain loaded only when there is at least one client application with a connection. This means that when a user moves between Agent-enabled Web pages, Agent will shut down and any characters you loaded will disappear. To keep Agent running between pages (and thereby keep a character visible), create another client that remains loaded between page changes. For example, you can create an HTML frameset and declare an <OBJECT> tag for Agent in the parent frame. You can then script the pages you load into the child frame(s), to call into the parent's script. Alternatively, you can also include an <OBJECT> tag on each page you load into the child frame. In this case, remember that each page will be its own client. You may need to use the Activate method to set which client has control when the user interacts with the parent or child page.