BINDSCRB: Illustrates an MFC Binder-Compatible Server

Click to open or copy the BINDSCRB project files.

The BINDSCRB sample illustrates the use of new Active™ interfaces for components used to build Active documents. An application that is an Active document server can be contained in any Active document object container. The sample is so named because the Microsoft® Office Binder, included in Microsoft® Office 95, was the first tool to support containment of these objects. The Binder acts as a client, while the documents are served by Active document servers.

BINDSCRB behaves like the SCRIBBLE sample, but shares the user interface of its container if its container supports Active documents. If the container does not support Active documents, BINDSCRB behaves like a normal Active component. Active document containers include the Microsoft Office Binder and Microsoft® Internet Explorer 3.0. The Active interfaces provided by an Active document container differ slightly from normal Active interfaces so that the Binder can provide a specialized user environment.

Running the Sample

You need to run BINDSCRB once as a standalone application so it can register itself with the system. When you run BINDSCRB, you will notice that it does not look much different from the SCRIBBLE sample. After you close BINDSCRB, you can start the Office Binder, Microsoft Internet Explorer 3.0, or any other Active document container application. Use the command appropriate for that application to insert the BINDSCRB object into the container. If you use the Office Binder, for example, you should click Add on the Section menu to reach the Add Section dialog box. The Add Section dialog box has an entry in the As a Blank Section list box that corresponds to the BINDSCRB sample. Select this entry and click OK in the dialog box to add a new BINDSCRB document to the binder.

Since BINDSCRB implements all the necessary binder interfaces for persistence, you can load and save the content of the binder in a Binder file, including any changes you make to the sample. Similarly, you can open a Binder file and expect to see a BINDSCRB document with your changes.

BINDSCRB works by adding implementations of the binder-specific Active interfaces to the interfaces that MFC classes enabled for Active documents, like COleServerDocument, already support. It does this by registering itself with MFC as an Active document server application. MFC contains code to support these new interfaces. For further information, see CDocObjectServer and CDocObjectServerItem in the MFC Class Library Reference and Internet First Steps: Active Documents and Active Documents in the Visual C++ Programmer's Guide.

Note that a sample with this same name was provided in the MFC 4.1 package. This sample has been significantly revised, and can only be built using MFC 4.2 or later because it relies on Active document support available MFC 4.2.

This sample demonstrates the following keywords:

AfxMessageBox; AfxOleInit; CArchive::IsStoring; CCmdUI::Enable; CCmdUI::SetCheck; CControlBar::EnableDocking; CControlBar::GetBarStyle; CControlBar::SetBarStyle; CDC::DPtoLP; CDC::GetDeviceCaps; CDC::GetTextMetrics; CDC::LPtoDP; CDC::LPtoHIMETRIC; CDC::LineTo; CDC::MoveTo; CDC::SelectObject; CDC::SetMapMode; CDC::SetTextAlign; CDC::SetViewportExt; CDC::SetWindowExt; CDC::SetWindowOrg; CDC::TextOut; CDialog::DoModal; CDocTemplate::SetServerInfo; CDocument::DeleteContents; CDocument::GetFirstViewPosition; CDocument::GetNextView; CDocument::OnNewDocument; CDocument::OnOpenDocument; CDocument::SetModifiedFlag; CDocument::UpdateAllViews; CFont::CreateFontIndirect; CFrameWnd::Create; CFrameWnd::DockControlBar; CFrameWnd::EnableDocking; CFrameWnd::LoadFrame; CFrameWnd::OnCreateClient; CObList::GetHeadPosition; CObList::GetNext; CObject::AssertValid; CObject::Dump; CObject::IsKindOf; CObject::Serialize; COleDocIPFrameWnd; COleDocument::EnableCompoundFile; COleIPFrameWnd::OnCreateControlBars; COleServerDoc::GetEmbeddedItem; COleServerDoc::GetZoomFactor; COleServerDoc::NotifyChanged; COleServerDoc::OnGetEmbeddedItem; COleServerDoc::OnSetItemRects; COleServerItem::CopyToClipboard; COleServerItem::GetDocument; COleServerItem::IsLinkedItem; COleServerItem::OnDraw; COleServerItem::OnGetExtent; COleTemplateServer::ConnectTemplate; COleTemplateServer::UpdateRegistry; CPen::CreatePen; CRect::InflateRect; CRect::IntersectRect; CRect::SetRectEmpty; CScrollView::SetScrollSizes; CSplitterWnd::Create; CStatusBar::Create; CStatusBar::SetIndicators; CToolBar::Create; CView::DoPreparePrinting; CView::GetDocument; CView::OnBeginPrinting; CView::OnDraw; CView::OnEndPrinting; CView::OnInitialUpdate; CView::OnPrepareDC; CView::OnPreparePrinting; CView::OnPrint; CView::OnUpdate; CWinApp::AddDocTemplate; CWinApp::Enable3dControls; CWinApp::InitInstance; CWinApp::LoadStdProfileSettings; CWnd::DoDataExchange; CWnd::GetCapture; CWnd::Invalidate; CWnd::InvalidateRect; CWnd::OnCreate; CWnd::OnLButtonDown; CWnd::OnLButtonUp; CWnd::OnMouseMove; CWnd::OnSize; CWnd::PreCreateWindow; CWnd::SetCapture; CWnd::SetOwner; CWnd::ShowWindow; CWnd::UpdateWindow; CreatePen; DeleteObject; DragAcceptFiles; GetClipBox; LPtoDP; RGB; ReleaseCapture; SetRectEmpty; max; memset; min