Compartir a través de


IPDRIVE Sample: Demonstrates an Automation Client Application

The IPDRIVE sample is a simple Automation (formerly OLE Automation) client application that drives the INPROC sample application. It tests the functionality provided by INPROC, an Automation in-process server. IPDRIVE can drive both the in-process version and the out-of-process or local server version of INPROC, demonstrating the performance advantages of in-process components. See the INPROC sample for more information.

Note

Before running IPDRIVE, you must run the INPROC sample application so that INPROC registers itself in the registry.

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 IPDRIVE sample

  1. Follow the instructions to run, build, and register the INPROC sample.

  2. Open the solution ipdrive.sln.

  3. On the Build menu, click Build.

  4. Run IPDRIVE as a stand-alone application so it can register itself with the system.

    When you run IPDRIVE, it will load the INPROC sample and create a variant map object that you can manipulate using IPDRIVE's interface.

A variant map object is much like the MFC CMap collection. It is used to map one arbitrary value to another arbitrary value. Each value is a VARIANT, which consists of a type and a value. The IPDRIVE user interface allows you to access both the type and the value. Any type/value pair can be mapped to any other type/value pair.

IPDRIVE also provides two buttons, Test1 and Test2, which can be used to test the performance of the INPROC server application. For the most part, these functions test the function call overhead of automation. Function call overhead is expected to be much greater with the local server versions of INPROC than with the in-process versions of INPROC. A local server runs in its own address space as a separate executable. As such, it requires a remote procedure call (RPC) to access the methods and properties of its objects. An in-process server, however, loads as a DLL in the client's address space and does not require an RPC. Both the Test1 and Test2 buttons execute for exactly five seconds, then display the number of calls. The more calls, the better the performance.

INPROC also contains a simpler collection (a string array), which is not exercised by IPDRIVE.

Keywords

This sample demonstrates the following keywords:

AfxMessageBox; AfxOleInit; AfxThrowUserException; CArchive::IsStoring; CComboBox::GetCurSel; CComboBox::SetCurSel; CControlBar::EnableDocking; CControlBar::GetBarStyle; CControlBar::SetBarStyle; CDialog::DoModal; CDocument::OnNewDocument; CFrameWnd::DockControlBar; CFrameWnd::EnableDocking; CObject::AssertValid; CObject::Dump; CObject::Serialize; COleDispatchDriver::GetProperty; COleDispatchDriver::InvokeHelper; COleDispatchDriver::SetProperty; CScrollView::ResizeParentToFit; CStatusBar::Create; CStatusBar::SetIndicators; CString::AllocSysString; CString::Format; CString::GetBuffer; CString::LoadString; CString::ReleaseBuffer; CToolBar::Create; CToolBar::LoadBitmap; CToolBar::SetButtons; CView::GetDocument; CView::OnInitialUpdate; CWinApp::AddDocTemplate; CWinApp::InitInstance; CWinApp::LoadStdProfileSettings; CWinApp::OnFileNew; CWnd::DoDataExchange; CWnd::GetDlgItem; CWnd::GetParentFrame; CWnd::GetWindowText; CWnd::OnCreate; CWnd::SetDlgItemText; CWnd::SetWindowText; DragAcceptFiles; GetKeyState; GetTickCount; max; wsprintf

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.

See Also

Other Resources

MFC Samples