Export (0) Print
Expand All

CONTAINER Sample: Visual Editing Container Application

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 noteSecurity Note

This sample code is intended to illustrate a concept, and it shows only the code that is relevant to that concept. It may not meet the security requirements for a specific environment, and it should not be used exactly as shown. We recommend that you add security and error-handling code to make your projects more secure and robust. Microsoft provides this sample code "AS IS" with no warranties.

To get samples and instructions for installing them:

To access samples from Visual Studio

  • On the Help menu, click Samples.

    By default, these samples are installed in drive:\Program Files\Microsoft Visual Studio 10.0\Samples\.

  • For the most recent version of this sample and a list of other samples, see Visual Studio Samples on the MSDN Web site.

To build and run the CONTAINER sample

  1. Open the solution container.sln.

  2. On the Build menu, click Build.

  3. On the Debug menu, click Start Without Debugging.

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

NoteNote

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.

Other Resources

Show:
© 2014 Microsoft