Export (0) Print
Expand All

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.

NoteNote:

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 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.

To get samples and instructions for installing them:

  • On the Visual Studio Help menu, click Samples.

    For more information, see Visual Studio Samples.

  • The most recent version and complete list of samples is available online from the Visual Studio 2008 Samples page.

  • You can also locate samples on your computer's hard disk. By default, samples and a Readme file are copied into a folder under \Program Files\Visual Studio 9.0\Samples\. For Express editions of Visual Studio, all samples are located online.

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.

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

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

Community Additions

ADD
Show:
© 2014 Microsoft