The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.
3 out of 4 rated this helpful - Rate this topic

OLEVIEW Sample: ActiveX Object Viewer 

Download sample

The OLEVIEW sample illustrates how to implement ActiveX Object viewers through custom ActiveX interfaces. These custom interfaces are implemented in Iviewers.dll.

Security noteSecurity 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. Microsoft assumes no liability for incidental or consequential damages should the sample code be used for purposes other than as intended.

Building and Running the Sample

To build and run the OLEVIEW sample

  1. Open the solution oleview.sln.

  2. On the Build menu, click Build.

The application has an SDI interface with two panes. The left pane allows you to browse the registry by means of a tree control. Once you select a node, the right pane will display the pertinent information.

Note that this sample application cannot display information for all the objects, but rather only for objects that support the IViewer interface.


This sample demonstrates the following keywords:

AfxGetInstanceHandle; AfxMessageBox; AfxOleInit; AfxThrowMemoryException; AfxThrowOleException; BitBlt; CBitmap::CreateBitmap; CBitmap::LoadBitmap; CBrush::CreateSolidBrush; CCmdTarget::BeginWaitCursor; CCmdTarget::EndWaitCursor; CDC::Attach; CDC::BitBlt; CDC::CreateCompatibleDC; CDC::DeleteDC; CDC::Detach; CDC::GetPixel; CDC::GetTextMetrics; CDC::SelectObject; CDialog::DoModal; CDialog::OnInitDialog; CDocument::OnCloseDocument; CDocument::OnNewDocument; CDocument::UpdateAllViews; CFileDialog::DoModal; CFileDialog::GetPathName; CFont::CreateFontIndirect; CFrameWnd::Create; CFrameWnd::GetActiveDocument; CFrameWnd::LoadFrame; CFrameWnd::OnCreateClient; CFrameWnd::SetActiveView; CGdiObject::DeleteObject; CListBox::SetCurSel; CObject::AssertValid; CObject::Dump; CRect::Height; CRect::Width; CScrollView::SetScrollSizes; CSplitterWnd::CreateStatic; CSplitterWnd::CreateView; CSplitterWnd::GetColumnInfo; CSplitterWnd::GetPane; CSplitterWnd::SetColumnInfo; CStatic::SetIcon; CString::Format; CString::GetBuffer; CString::IsEmpty; CString::LoadString; CString::ReleaseBuffer; CView::GetDocument; CView::OnDragEnter; CView::OnDragLeave; CView::OnDragOver; CView::OnDrop; CView::OnInitialUpdate; CView::OnUpdate; CWinApp::AddDocTemplate; CWinApp::ExitInstance; CWinApp::InitInstance; CWinApp::OnFileNew; CWinApp::SetRegistryKey; CWnd::DoDataExchange; CWnd::DragAcceptFiles; CWnd::GetParent; CWnd::GetSafeHwnd; CWnd::GetStyle; CWnd::GetWindowPlacement; CWnd::GetWindowRect; CWnd::OnCreate; CWnd::OnDestroy; CWnd::OnSize; CWnd::OnSysColorChange; CWnd::ScreenToClient; CWnd::SetFocus; CWnd::SetFont; CWnd::SetRedraw; CWnd::SetWindowPlacement; CWnd::SetWindowPos; CWnd::SetWindowText; CWnd::ShowWindow; ClientToScreen; CoCreateInstance; CoFreeUnusedLibraries; CoGetClassObject; CoGetMalloc; CreateSolidBrush; DeleteItem; DeleteObject; EnumFontFamilies; ExtTextOut; ExtractIcon; FormatMessage; FreeLibrary; FreeProcInstance; GetBkColor; GetClientRect; GetDC; GetDeviceCaps; GetNearestColor; GetObject; GetParent; GetProcAddress; GetProfileInt; GetProfileString; GetStockObject; GetSysColor; GetSystemMetrics; GetTextExtentPoint; GetTextMetrics; GetUserDefaultLCID; GetVersionEx; GetWindowLong; GetWindowRect; IClassFactory::CreateInstance; IMalloc::Free; IUnknown::QueryInterface; IUnknown::Release; IsWindow; LoadBitmap; LoadIcon; LoadLibrary; LoadLibraryEx; LocalFree; MAKEINTRESOURCE; MakeProcInstance; MulDiv; OffsetRect; Polygon; RGB; RectVisible; RegCloseKey; RegEnumKey; RegOpenKey; RegQueryValue; ReleaseDC; SelectObject; SetBkColor; SetTextColor; SetWindowPos; TabbedTextOut; WinExec; WinHelp; WriteProfileString; _fstrnicmp; atoi; isdigit; isspace; isxdigit; lstrcat; lstrcmpi; lstrcpy; lstrlen; max; strrchr; toupper; wsprintf


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.

See Also

Other Resources

MFC Samples

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2014 Microsoft. All rights reserved.