InterfaceDefinition: ECom Interface Definition Example Code

Download

Click on the following link to download the example: Ecom.zip

Download some additional files required by the example: CommonFramework

Click: browse to view the example code.

View the additional files: browse.

Description

InterfaceDefinition provides an example ECom interface definition. It declares a base class, CExampleInterface, from which implementations of the interface should derive.

CExampleInterface provides three NewL() functions that allow clients to get respectively:

  • the default implementation of the interface, using a specified custom resolver to determine what is the default

  • an implementation determined by the default resolver, using a specified string as a resolution parameter

  • an implementation determined by the default resolver, using a specified string as a resolution parameter, and passing some data to the implementation

CExampleInterface uses the overloads of REComSession::CreateImplementation(TUid, TUid &) to implement these functions.

CExampleInterface declares one pure virtual function, DoMethodL(), which supplies a service to the client. Implementations must implement this function.

InterfaceDefinition also provides an example of a custom resolver, called CExampleResolver. Its behaviour is the same as ECom's default resolver. Because a resolver is an implementation of the ECom CResolver interface, it requires a registration resource file (100098ea.rss), and an exported factory table (Proxy.cpp).

Usage

Building InterfaceDefinition exports the files that contain the interface definition, Interface.h and Interface.inl, to epoc32\include\; produces a DLL ExampleResolver.dll; and compiles a resource file ExampleResolver.rsc in the \resource\plugins\ directory.

Implementations of the interface are provided in the Interface Implementation example.

A client program that accesses the interface is provided in the Interface Clientexample.