OLEVIEW Sample: ActiveX Object Viewer

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

Note

Some of the 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.

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.

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.

Keywords

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

See Also

Other Resources

MFC Samples