Objective Toolkit : Chapter 24 Microsoft Agent Extensions : Using the Agent Extension Classes In Your Applications
Using the Agent Extension Classes In Your Applications
1. Build the Objective Toolkit libraries with the Microsoft Agent Extensions option enabled in the Build Wizard.
2. Derive your application object from SECAgentApp, as follows:
 
class CAgent1App : public SECAgentApp<CWinApp>
3. In your application’s InitInstance(), call LoadAgent() followed by AttachChar() to create a default character for your application. You can access the default character from anywhere in your application via the m_pptrChar member in IAgentApp.
4. For Agent-enabled Dynamic Data Validation, in your overridden DoDataExchange() in your formview or dialog, call
 
IAgentApp* pAgentApp = dynamic_cast<IAgentApp*>(AfxGetApp());
BEGIN_AGENT_DDV(pAgentApp)
in the beginning and
END_AGENT_DDV()
at the end.
5. For tooltip support, include the DECLARE_AGENT_TOOLTIPS() macro in your parent view or window class’s header (.h) file and BEGIN_AGENT_TOOLTIPS() macro in the corresponding implementation (.cpp) file.
6. For Tip of the Day support, call EnableTipOfTheDay() and override the GetTipOfTheDayAct() virtual defined in IAgentApp. Then, a Tip will be executed whenever the user selects the “Next Tip” command.
7. You can also call the MessageBox on the character object to display a message box and make the Agent read out the text in the message box.
8. Be sure to call UnLoadAgent() in your application’s ExitInstance().
Take a look at the sample provided for more information.
Agent Extensions Sample
The agent sample under the samples\toolkit\MFC directory demonstrates the use of the Agent Extension classes.