Title: Introduction to COM Part I
1Chapter 2
- Introduction to COM (Part I)
2Objectives
- Describe the COM Architecture
- Discuss Anatomy and benefits of an Interface
- Discuss the standard COM interface
- The IUnknown Interface
- Describe different types of Component Packaging
- In-process Server
- Out-of-process Server
- Remote Server
- Discuss the terminologies associated with COM
- HRESULT
- GUID
3Component Object Model
Elements of COM
4Component Object Model (1)
Advantages
- Fully language-independent
Supports version compatibility
Provides Location Transparency
5Component Object Model (2)
COM does not compete with technologies like DLL
it uses them extensively
Highlights
COM is not a programming language it is a set of
specification
COM is not an API it is a way to develop
component-oriented application
6Component Object Model (3)
- Features
- Creation and use of reusable component objects
- A binary standard for interoperability
- A true system model
- Provides distributed objects
7COM Application Architecture
8Interface
An Interface not only defines how two components,
or a client and a component will talk to each
other but also helps in hiding the business logic
used for developing the object.
9COM Object with Interfaces
Standard Representation
10Using Interfaces With COM Components
Advantages
Reusable application architectures
Hidden internal implementation of the component
Language independence for developing the component
11Attributes of Interfaces
- An Interface is not a class
- An Interface is not a component object
- Clients interact only with the pointers to the
Interfaces
- Components can implement multiple interfaces
12IUnknown Interface
The IUnknown interface helps the client
application to scan for other interfaces
available in the component and get their
pointers.
13Component Packaging Types
In-process server
 Out-of-process server
Remote server
14In-Process Server
In-proc Object
In-proc Server
Client Application
Client Process
The in-proc servers are implemented in the form
of a DLL.
15In-process Server (1)
Advantages
Saves memory space
Saves disk space
Upgradations are easy
Supports multiple languages
16Out-of-Process Server
The out-of process servers are implemented in the
form of an EXE.
17Out-of-Process Server (1)
Advantages
Crash protection
Support for User Interface
18Out-of-Process server (2)
Drawbacks
Slow responsiveness
19Remote Server
Remote Machine
Client Machine
The remote servers are implemented in the form of
either EXE or DLL.
20Remote Server (1)
Advantages
A single component can be shared by multiple
client applications running on multiple systems
The components can be upgraded very easily
It forms the basis for component based
distributed client/server architecture
21Remote Server (2)
Drawbacks
Slow responsiveness
22HRESULT
The call may or may not be successful
Processing is carried out further depending on
the HRESULT value
23Globally Unique Identifiers
Just as a vehicle or a passport have unique
numbers for identification, components also have
unique ids called Globally Unique IDentifiers
(GUID)