Click to open or copy the CHATTER project files.
CHATTER is a Windows Sockets Client sample application. It is a single-document interface (SDI) application with a splitter window that lets the user send messages to a discussion server (CHATSRVR), which in turn sends them to multiple other CHATTER users simultaneously.
When you run CHATTER, a Setup dialog box asks for the following:
Once you provide all the information and click OK, the main application window appears. To send a message, type it in the bottom pane. Pressing enter will send it. To send a multiline message, use CTRL+ENTER.
It is important to note that CHATTER and CHATSRVR could have been written without using a client/server model by having the CHATTER applications send broadcast datagram packets instead of streaming messages to a server. However, this would produce a program with two serious limitations:
This sample demonstrates the following keywords:
AfxGetApp; AfxMessageBox; CArchive::Flush; CArchive::IsStoring; CControlBar::EnableDocking; CControlBar::GetBarStyle; CControlBar::SetBarStyle; CDialog::DoModal; CDocument::DeleteContents; CDocument::GetFirstViewPosition; CDocument::GetNextView; CDocument::OnNewDocument; CEditView::GetEditCtrl; CEditView::SerializeRaw; CFrameWnd::DockControlBar; CFrameWnd::EnableDocking; CFrameWnd::OnCreateClient; CFrameWnd::SetActiveView; CObject::AssertValid; CObject::Dump; CObject::IsKindOf; CObject::Serialize; CRect::Size; CSplitterWnd::CreateView; CSplitterWnd::GetPane; CStatusBar::Create; CStatusBar::SetIndicators; CString::GetBuffer; CString::GetLength; CString::IsEmpty; CString::LoadString; CString::ReleaseBuffer; CToolBar::Create; CToolBar::LoadBitmap; CToolBar::SetButtons; CView::GetDocument; CView::OnDraw; CWinApp::AddDocTemplate; CWinApp::Enable3dControls; CWinApp::InitInstance; CWinApp::LoadStdProfileSettings; CWinApp::OnFileNew; CWnd::DestroyWindow; CWnd::DoDataExchange; CWnd::GetClientRect; CWnd::GetWindowText; CWnd::GetWindowTextLength; CWnd::KillTimer; CWnd::OnChar; CWnd::OnCreate; CWnd::OnTimer; CWnd::PreCreateWindow; CWnd::SetTimer; CWnd::SetWindowText; SetWindowText; rand; wsprintf