What is IUnknown? Explain some of commonly used methods provided by IUnknown. Explain message routing and message loop.What is IUnknown? Explain some of commonly used methods provided by IUnknown.
IUnknown is the base interface for every COM class. Through all this COM interfaces are derived. It uses three methods which are as follows:
QueryInterface() which explores the feature
AddRef() which includes the object life time management and it increments the object reference count
Release() also takes part in object life time management and it decrements the object reference count
Explain message routing and message loop.
A visible window on screen has to go through many functions and phases before the show. It contains functions like CreateWindow and ShowWindow and functions other than that also. When window gets displayed on the screen then it has to make itself ready to take the control of keyboard and mouse which will be given by the user. The system maintains a message queue for each program currently running on the system. When any input occurs, the system translates this event into a message and places into the system message queue. A program receives that message from the message queue and executes the block of code this is known as message loop. And passing the message from one process to another is called message routing. This is done by passing the exact message to the process which wants to be executed at the time of execution.
|