Partager via


Visual C++: Code Sample Information

The Visual C++ OSP sample is set up to have MyOSPObject as the implementation of the sample provider and MyDataSource as the implementation of the OSP data source object.

Important

This feature will be removed in a future version of Windows. Avoid using this feature in new development work, and plan to modify applications that currently use this feature. Instead, write a fully functional OLE DB provider using the native OLE DB interfaces.

The Microsoft Visual C++ simple provider code sample is located in ..\Samples\DataAccess\Osp\Vc and consists of the files described in the following table.

File name

Description

MyOSPObject.h

Class and method definitions for MyOSPObject.

MyOSPObject.cpp

Implementation code for MyOSPObject. Contains the following:

  • Constructor and destructor, initialization routines, QueryInterface of MyOSPObject.

  • Routines to create an internal table, load data into the table from an external file, and save the data.

  • OSP method implementations.

MyDataSource.h

Class and method definitions for MyDataSource.

MyDataSource.cpp

Implements the MyDataSource object and its IDataSource methods. Contains the following:

  • Constructor and destructor, initialization routines, QueryInterface of MyDataSource.

  • IDataSource method implementations, including getDataMember, which gets the OSP implementation.

MyClassFactory.h

Contains the class definitions for MyClassFactory and the DLL entry points.

MyClassFactory.cpp

The sample's implementation of the IClassFactory interface. Implements the main DLL entry point.

SampleOSP_VC.def

Names the overall DLL and lists the entry points.

SampleOSP_VC.dsp

Visual C++ project file for the sample.

SampleOSP_VC.reg

Copy of the RegisterProvider.reg file for use with the Visual C++ sample.

Common.cpp

Common Visual C++ routines used for this sample.

Common.h

Set of common Visual C++ macros used for this sample.