------------------------------------------------------------------ Microsoft Chat SDK 2.0 Samples Readme File January 1998 ------------------------------------------------------------------ (c) Copyright Microsoft Corporation, 1998 CONTENTS ======== OVERVIEW OF THE CHAT2000 SAMPLE BUILDING THE CHAT2000 SAMPLE OVERVIEW OF THE CHAT2000 SAMPLE ============================== Chat2000 is a sample app that demonstrates how to use the Chat OCX inside an MDI MFC application. The goal of this sample is to clearly show how to: * Create multiple OCX instances dynamically * Use OCX methods * Set and Get OCX properties * Handle OCX events The Sample does not fully implement its own UI but rather extends the standard OCX one with the following features: * Multiple chat sessions. Join as many chat rooms as you want. * Content sensitive right-click pop up menu * Kick and Ban participants * Set your preferences for every Chat session you join or create * Clear or Save history in .rtf file * Status info displayed in Status bar and MDI title * Get MSChat info The Sample uses the Document/view architecture of the Microsoft Foundation Classes. The application was generated by the AppWizard as an MDI-type application. The support for OLE controls was added manually. The CMSChat class was generated by the ClassWizard using the Insert Component menu. Some methods were changed to facilitate the development process but no changes are necessary to use the Class. The OCXes are created at runtime in the view method CChat2000View::OnCreate(). The view owns the OCX because is not possible to implement multiple view of the same chat room without re-implementing the UI completely. The view exports the only data needed by the document using the wrapper function CChat2000View::GetHistory(). The OCX Methods are generally called within appropriate command handler functions. The view is also responsible for updating the status bar and the MDI title. OCX events are trapped using the MFC standard event sink mechanism (BEGIN_EVENTSINK_MAP / END_EVENTSINK_MAP). Unfortunately the ClassWizard does not help generate the sink map, so this code needs to be added manually. This example also illustrates how to use MFC CList template how to implement a pop-up menu for a control. The application uses the CList template to implement a list of participants (CParticipant object). The list is used to verify the status of ‘this participant’ and to fill up the Drop-down in the ‘Ban’ dialog. The Pop-up menu is created in the CChat2000View::OnParentNotify() function. This function wraps up the WM_PARENTNOTIFY window message used by child controls to notify the parent of events such as creation, destruction and mouse clicks. Since the OCX covers all the view the WM_FOCUS message gets to the view after the WM_PARENTNOTIFY. This leaves the pop up menu in an incorrect state. To alleviate the problem the view keeps track of its own activation/deactivation giving a chance to the MFC OnUpdate functions to take care of the menu items states. BUILDING THE CHAT2000 SAMPLE ============================ The chat2000 sample can be built with Visual C++ 4.2 or later versions of Visual C++.