LOGMONITOR: This simple sample extension monitors for chat users login/logout notifications and outputs a report to a text file (C:\CHATSESS.LOG) This sample is built using MS Visual C++ 5.0 and ATL. You must have Mircosoft Exchange Chat Service V5.5 SP1 installed. ///////////////////////////////////////////////////////////////////////////// Summary of steps to create a C++ Chat Extensibility component. 1) Create a new 'ATL COM AppWizard' project: - Select Dynamic Link Library (DLL) - Do not select 'Allow merging of proxy/sub code' - Support MFC as necessary 2) Add a 'New ATL Object' / Simple Object: - Name object as necessary - Set Attributes: For Threading either: Appartment (recomended) Free - You need only to support 'Custom Interface' - You may select 'No Aggregation' - You do not need ISupportErrorInfo/Connection Points 3) Edit your project's IDL file - Remove the default interface that was created for your new object - Add an importlib for the chat extensibility typelib - Add the Chat Callback interfaces you need to support e.g. import "oaidl.idl"; import "ocidl.idl"; [ uuid(8A66F6DB-80AD-11D1-98C6-00C04FB90B72), version(1.0), helpstring("CustomCommand 1.0 Type Library") ] library CUSTOMCOMMANDLib { importlib("stdole32.tlb"); importlib("stdole2.tlb"); importlib("chatsvc.exe"); [ uuid(8A66F6EB-80AD-11D1-98C6-00C04FB90B72), helpstring("Chat Extensibility CustomCmd Class") ] coclass CustomCmd { interface IChatExtensionCallBack; interface IChatServerCallBack; }; }; 4) Add references to the Chat Extensibility object model include files #include "..\inc\chatsvc.h" in StdAfx.h #include "..\inc\chatsvc_i.h" in your project's main CPP file 5) To allow the chat administration see your component - Add a catorgory implementation registry entry for your component by adding it to your objects RGS file. (Note the quotes) e.g. ForceRemove {B4EF354F-809E-11D1-98C6-00C04FB90B72} = s 'SessionMonitor Class' { ProgID = s 'SessionMonitor.SessionMonitor.1' VersionIndependentProgID = s 'SessionMonitor.SessionMonitor' InprocServer32 = s '%MODULE%' { val ThreadingModel = s 'Apartment' } 'Implemented Categories' { {26ED0606-44D2-11D1-9045-00C04FB6E8E9} } } 5) Modify your extension object's header file - Remove the inheritence from your old default interface - Add the Chat callback interface to your new objects inheritence. e.g. class ATL_NO_VTABLE CCustomCmd : public CComObjectRootEx, public CComCoClass, public IDispatchImpl, public IDispatchImpl - Remove the COM_INTERFACE_ENTRY for you old default interface - Add COM_INTERFACE_ENTRY for each of the chat callback interfaces e.g. BEGIN_COM_MAP(CCustomCmd) COM_INTERFACE_ENTRY(IChatExtensionCallBack) COM_INTERFACE_ENTRY(IChatServerCallBack) END_COM_MAP() Add definitions for each of the pure virtuals in the callback interfaces. e.g. STDMETHOD(OnInstall)(void); STDMETHOD(OnUninstall)(void); STDMETHOD(OnConfigureExtension)(IChatUser *User, BSTR Command); STDMETHOD(Init)(IChatServer *Server, IChatRegistrar *Registrar, long *retCode); STDMETHOD(Term)(long *retCode); STDMETHOD(OnGetPropertyPageClass)(PROPERTY_PAGE Page, BSTR *ctrl); STDMETHOD(get_Name)(BSTR *Name); Add the implementation for each of the callback methods.