COM AND CONNECTION POINT

What is COM?
    1) COM stands for Component Object Model
    2) It is a binary standard that enables software components to interact with each other as objects.
    3) It is a programming model that can work with any language that can support its objects.
    4) It supports encapsulation, inheritance and polymorphism.
    5) The COM IDL is based on the feature-rich DCE/RPC IDL, with object-oriented extensions. 

Types
    1) Inproc Server (DLL)
    2) Outproc Server (EXE)
    3) Service (EXE) 

Basic Elements of COM

What is an IDL file
  1) IDL stands for Interface Definition Language.
       2) COM interfaces are defined using IDL file.

What is a Library
  1) It is used to generate type library.
       2) A type library is a binary representation of the IDL.
What is a Coclass
  1) The COM class or coclass is declared inside the Library.
       2) It lists the interfaces that are part of it (groups the interfaces).

What is an Interface
Consists of two types of items: properties and methods.
This is the Base interface of a COM object.
Important methods:
         1) QueryInterface - gets a pointer to an interface.
      2) AddRef - each time a new instance is instantiated, the reference count is incremented through AddRef.
      3) Release - each time a  reference is destroyed, the reference counter is decremented with Release.  Once the reference count is zero, the object can be destroyed.
1)  Derived from IUnknown provides additional methods.
      2)  A dispatch id is a required index when IDispatch is used.
      3)  Dispatch ID identifies the interface method that is to be invoked.
A dual interface in COM is one that is able to be accessed via a DispInterface or via VTable methods.

What is uuid
The unique identifier for the interface which becomes its COM interface ID (known as IID).

       2) Creates proxy/stub marshalling code.
       3) Creates the type library (tlb) file.

What is ATL
1) It stands for Active Template Library.
       2) It is a template based library used to create COM components.

Why registration is required for a COM component
1) In order for the OS to find a component when a program needs it, it must be registered with the system. 
2) The system then records it in the Registry.
3) Usually a component is registered by running the program REGSVR32.EXE.
The registry holds all this information
1) The physical location of the file that implements the COM object.
      2) All the classes and Interfaces the COM object has.
      3) Other important information.

Methods to call COM Component in the application
  1.  using CoCreateInstance.
  2.  using Type Library (tlb) - provides smart pointers.
  3.  using Smart pointers CComQIPtr and CComPtr.

Connection point

What is Connection point and why it is needed
  1) It provides two way communication between server and client.      
       2) Clients get call back notification from the COM object.
       3) It acts as a middle-man between the server and all its clients: 
                Whenever the server needs to notify all its clients, it tells the connection point to do it.

What is source and sink
The server is called source and the client is called as the sink.

  1) The source exposes an interface known as IConnectionPointContainer which provides access to an object’s connection points. 
       2) The sink can call the IConnectionPointContainer::FindConnectionPoint method to get access to a specific connection point.

What is Advise and UnAdvise
  1) A sink registers with a connection point by calling IConnectionPoint::Advise.
       2) It unregisters by calling IConnectionPoint::Unadvise.


Refer:     REMOTE PROCEDURE CALL

Popular posts from this blog

OBJECT ORIENTED ANALYSIS AND DESIGN (OOAD)

OBJECT ORIENTED PROGRAMMING

STARTING A BUSINESS