Creating a Notification Sink

[Microsoft Agent is deprecated as of Windows 7, and may be unavailable in subsequent versions of Windows.]

To be notified of events by Microsoft Agent, you must implement either the IAgentNotifySinkor the IAgentNotifySinkEx interface, and create and register an object of that type following COM conventions:

// Create a notification sink

pSinkEx = new AgentNotifySinkEx;

pSinkEx->AddRef();

// And register it with Microsoft Agent

hRes = pAgentEx->Register((IUnknown *)pSinkEx, &lNotifySinkID);

Remember to unregister your notification sink when your application shuts down and releases Microsoft Agent's interfaces.