The CONTAINER sample is a simple example of a Visual Editing container application.
CONTAINER illustrates the following:
Container starter code created by the application wizard.
The application-specific classes CContainerItem and CContainerView and the MFC classes COleClientItem and COleDocument.
Selection and hit detection of embedded objects.
Activation of embedded objects.
Tracker rectangles using the CRectTracker class.
For examples of more advanced Visual Editing container features, see the DRAWCLI and OCLIENT sample applications.
| Security Note |
|---|
This sample code is provided to illustrate a concept and should not be used in applications or Web sites, as it may not illustrate the safest coding practices. |
Building and Running the Sample
To build and run the CONTAINER sample
Open the solution container.sln.
On the Build menu, click Build.
On the Debug menu, click Start Without Debugging.
Keywords
The CONTAINER sample demonstrates the following keywords:
AfxMessageBox; AfxOleInit; AfxThrowMemoryException; CArchive::IsStoring; CCmdTarget::BeginWaitCursor; CCmdTarget::EndWaitCursor; CDC::HIMETRICtoDP; CDialog::DoModal; CDocTemplate::SetContainerInfo; CDocument::OnNewDocument; CFrameWnd::Create; CFrameWnd::DockControlBar; CFrameWnd::EnableDocking; CFrameWnd::LoadFrame; CObject::AssertValid; CObject::Dump; CObject::Serialize; COleClientItem::Close; COleClientItem::CreateFromClipboard; COleClientItem::Deactivate; COleClientItem::Delete; COleClientItem::DoVerb; COleClientItem::Draw; COleClientItem::GetActiveView; COleClientItem::GetDocument; COleClientItem::GetInPlaceWindow; COleClientItem::GetItemState; COleClientItem::IsInPlaceActive; COleClientItem::OnChange; COleClientItem::OnChangeItemPosition; COleClientItem::OnDeactivateUI; COleClientItem::OnGetItemPosition; COleClientItem::SetItemRects; COleClientItem::UpdateLink; COleDocument::EnableCompoundFile; COleDocument::GetNextItem; COleDocument::GetStartPosition; COleInsertDialog::CreateItem; COleInsertDialog::DoModal; COleInsertDialog::GetSelectionType; CRect::PtInRect; CRect::SetRect; CRect::Size; CRectTracker::Draw; CRectTracker::GetTrueRect; CRectTracker::SetCursor; CRectTracker::Track; CView::DoPreparePrinting; CView::GetDocument; CView::IsSelected; CView::OnBeginPrinting; CView::OnDraw; CView::OnEndPrinting; CView::OnInitialUpdate; CView::OnPreparePrinting; CView::OnUpdate; CWinApp::AddDocTemplate; CWinApp::EnableShellOpen; CWinApp::InitInstance; CWinApp::LoadStdProfileSettings; CWinApp::RegisterShellFileTypes; CWnd::DoDataExchange; CWnd::Invalidate; CWnd::InvalidateRect; CWnd::OnCreate; CWnd::OnLButtonDblClk; CWnd::OnLButtonDown; CWnd::OnSetCursor; CWnd::OnSetFocus; CWnd::OnSize; CWnd::PreCreateWindow; CWnd::SetFocus; CWnd::ShowWindow; CWnd::UpdateWindow; DragAcceptFiles; GetKeyState
| Note |
|---|
Some samples, such as this one, have not been modified to reflect the changes in the Visual C++ wizards, libraries, and compiler, but still demonstrate how to complete your desired task. |