The ancient art of circles and lollipops

Since I will have to do COM in my new job, I wanted to make sure I knew COM inside out. I have used COM before, but only client side. I never wrote a COM server.


So I decided to finally work my way through ‘Essential COM’ to learn the nitty gritty details of COM. After all, a server is where all the ugly stuff happens.


I decided to ignore ATL and use only the raw platform COM API. This is tedious and cumbersome, but at least I’d know exactly how a COM server works. Learning ATL after that should not be too hard because at least I’ll know what I am doing, and why things are done a certain way.


The best way to describe the learning process is with the words of my fellow C++ MVP and friend, Carl Daniel: ‘As much archeology as engineering at this point in the lifecycle of COM


Examples and tutorials on the internet are generally several years old, and can have compilation problems. Another problem is that it is very hard to find examples about advanced functionality. The reason is simple. COM was invented before internet coding communities existed like today.


Then there is MSDN…


The COM documentation looks like it was written by a team of lawyers. Everything is factually correct, wide open to interpretation, and only to be understood if you can memorize and cross reference everything within your mind. And of course, a lot of things are simply never mentioned.


Let’s just say I have had a lot of fun so far. The great thing about hours and days of frustration and hitting brick walls is that it feel sooooo good when you finally figure out how stuff works.


 I think I’ve got a good understanding now of COM. I put my demo project in sourcesafe and ‘released’ a new version with each major new feature. If I have some free time I’ll write articles for www.codeproject.com, explaining each step along the way.


The first few articles will be relatively simple. The one about my current implementation will be really advanced, and cover a special topic that is very neat.


I won’t spoil the surprise J but I can say that literally nobody ever wrote an online article about it. The only mention of that particular technique I found was in a well respected COM reference book. And it was dead wrong…


So that proves that it is still possible to do very interesting stuff with technology that is over a decade old.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>