Showing posts with label COM. Show all posts
Showing posts with label COM. Show all posts

Notes from my Notebook

These are the notes that I have taken while reading a lot of technical books. The below text is straight from my notes and is not in any particular sequence:

1. MFC maps are dictionaries with key and value pairs
2. CDocTemplate = Docs + Views + FrameWindows
3. Activation is finding class objects, there are three ways of activation:
1. Object Binding - CoGetClassObject
2. Creating an instance of the class - CoCreateInstance
3. Getting the persistant object - CoGetInstanceFromFile
Activation also means finding class objects, loading the COM DLL, and starting the Server process.

There are two types of Activation:
1. In-process activation
2. Out-of-process activation

4. IClassFactory will have createInstance() and LockServer() methods
5. CoCreateInstanceEx = CoGetClassObject() + CreateInstance() + Release()
6. A Moniker is a locator object which finds/creates objects. A Display name is the textual representation of a moniker.

7. Inner class method calling:
carPlane::XCar::GetMaxSpeed();
8. AddRef() -> InterlockedIncrement()
Release() -> InterlockedDecrement()
9. Aggregation is a technique of exposing a binary subcomponent to a client
10. IUnknown is the most inportant interface in COM. All interfaces should be derived from IUnknown.

COM concepts

Here is one article which i found very useful when I was looking for something on COM. There are lot many sites on COM, but this one is explained in the simple language and covers all the important concepts of COM. It starts from basics like class and interface and goes on till threading. It also has links to other advanced COM concepts. For me this is one stop site to quickly refer to the COM concepts.

I have been reading a codeproject article on writing shell namespace extensions which is my favorite COM concept! Shell namespace extension is basically a COM component which integrates into Windows Explorer. For example, you can write an extension which actually is shown as a virtual drive in Windows Explorer. Clicking on this drive might show the registry contents or connect to gmail to show the gmail file attachments and so on.

The article is very simple though it addresses a complex concept. I have been in the team of maintaining a shell namespace extension for last two years and I have always wondered how it is developed. This article explains basics of shell namespace and goes into detail.

A PIDL (Pointer to ID List) is the basic concept of shell extension. it is the data structure Explorer uses to organize the items and sub-folders that are shown in the tree view. IEnumIDList, IShellView, IShellFolder are important namespace extension Interfaces.

Shell namespace extension itself is a big COM topic which has various concepts like PIDLs, namespaces, handling the treeview and folder views and many more.