
- #CREATE YOUR OWN MS AGENT CHARACTER HOW TO#
- #CREATE YOUR OWN MS AGENT CHARACTER CODE#
- #CREATE YOUR OWN MS AGENT CHARACTER FREE#
- #CREATE YOUR OWN MS AGENT CHARACTER WINDOWS#
The main events handled by an Agent Character are via its IAgentNotifySink interface.
#CREATE YOUR OWN MS AGENT CHARACTER HOW TO#
So as promised, here is how to make an event handler! This object is can be used to set the font, style etc of the speech bubbleĪnd that is essentially it! However, the Agent is not much use if it cannot respond to events. It is also possible to directly modify the Character's speech bubble too! This requires getting the IAgentBallonEx object for the Character and then calling the setter methods for the appropriate property such as Font, Style etc. This object is can be used to move the character around the screenĬharacterEx.MoveTo(( short ) value. I included a "Position" Point object to make moving the Agent Character around the screen a little easier! Simply pass in the new co-ordinates, and off it goes!! For a complete list of animations, please refer to the MS Agent SDK documention.ĬharacterEx.Speak("Hello C-sharp world!", null, out dwReqID) In this case, it plays the "Greet" animation. so now lets make it do something more useful! The Speak method will make he speak (obviously) and the Play method will animate it in. This makes the charater appear on the screen. The first parameter determines whether or not the character is SrvEx.GetCharacterEx(dwCharID, out CharacterEx) Now we can simply call the show method on our CharacterEx object! Now that we have loaded a character, its time register an event handler (more on that later) and show him, her or it to the world!! This is done simply by calling the GetCharacterEx method on the server passing in the dwCharID and our previously defined CharacterEx holder object. SrvEx.Load(CharacterFile, out dwCharID, out dwReqID) Ĭonsole.WriteLine("Failed to load Agent character! Exception details:") Once we have specified the character, we call the Load method on the Server Interface to load the character passing in the ints for the character and request ids that the COM object expects and catching any exceptions that are thrown - eg: using an invalid character name! Toolkits, however, are available to create your own! Genie.acs, robby.acs, peedy.acs, merlin.acs are the four characters that are supplied by default.
#CREATE YOUR OWN MS AGENT CHARACTER FREE#
However, feel free to change it to any of the others and give them a try! You would never do this in a real application, but I have hard coded the specific Agent character I want to use. Once we have the server object, we cast it to a IAgentEx interface that allows our application to load characters, receive events and determine the state of the Agent Server. Now its time to create 3 ints to hold the Character ID, Request ID and Sink ID, and an instance of the AgentServer, and return if this could not be completed for whatever reason, otherwise continuing.Ĭonsole.WriteLine("STOP: The Agent Server could not start") Ĭonsole.WriteLine("Agent Server created!") So lets walk through it.įirstly, we need an object that will be used to hold our actual Agent character! The no parameter constructor calls the StartAgent() method with is responsible for creating the MS Agent. Note the "using" statements we require for the MS Agent to function! This Class is essentially the work horse of the program. Private void helpMenuItem_Click( object sender, System.EventArgs e) The helpMenuItem_Click method triggers what we are really interested in! The menu contains only one option - "Agent Help".
#CREATE YOUR OWN MS AGENT CHARACTER WINDOWS#
The simple Windows Form contains nothing revolutionary, it is a simple window with a help menu. Other operating systems will need it specifically installing. Note that if you are using Windows 2000, this is installed by default. In order to run this example, you will need MS Agent agent installed. Net and the released Microsoft (R) Visual C# Compiler Version and tested on Windows 2000 Server SP2.
#CREATE YOUR OWN MS AGENT CHARACTER CODE#
The code is compiled using Visual Studio. This article explains how to include MS Agent into an simple Windows Form based application using C#.
