Basic COM tutorial

Hello everyone!

Would anyone recommend a simple COM tutorial, I eventually need to learn how to automate some functions in internet explorer and so on (configure options, etc.)
You probably want to look up some ATL tutorials. Don't attempt to use COM without ATL, it's a world of pain.

The definitive book is Inside COM by Dale Rogerson.
Last edited on
ATL tutorials is useless if you don't know what COM interfaces to use and how COM works.

ATL will only help you write few lines of code.
Agreed. First learn COM, then make sure you write at least one server entirely without frameworks (will build up your skills and strengthen your knowledge), then learn a framework like ATL.

If you are GOOD in C++, the definitive book is Essential COM by Don Box: http://www.amazon.com/Essential-COM-Don-Box/dp/0201634465 .
My thinking is more along the lines of modoran and webjose, but I'm sure you wish you could just 'wing it' quick with ATL as kbw suggested. You've really got a tough decision ToniAz. If you really need COM then it might be something that you'll have to put a lot of time into. It is a world of pain, unless you love it like I do. If you want in depth material I've written some material here...

http://www.jose.it-berater.org/smfforum/index.php?board=362.0

That particular material would serve as an excellent supplement to Dale Rogerson's book. In fact, I use a lot of his idioms in it. The material goes into a lot of detail about the binary standard and memory layout. You need to be fairly expert with pointers and dynamic memory allocation to understand it. The material switches between C, C++, and PowerBASIC quite a lot, with even some VB6 and .NET stuff thrown in. That's actually the way a lot of COM goes because one of its major attractions is that the servers created with it can be accessed from any decent language. Even some that aren't so 'decent' such as vb script or java script (just kidding!).

You know, I seem to believe you are working on some kind of browser. Here a couple months ago I posted a whole example of loading the IE Active X Browser Control in a Win32 Form. I used all low level COM with no ATL (well, very little ATL) or anything like that, and in fact I used CodeBlocks MinGW. The whole thing came to about a 9 K executable and you can browse the web with it, post here with it, etc. In fact, I posted the code here with it. Ask about it if interested. I can likely find it yet. Anyway, the ActiveX control has all the COM methods you need.

Thanks freddie and thanks all! I think I'm gonna take a look at ATL first.

Well actually my field of interest is no where near programming or C++, I just like this programming laguage a lot and like to fiddle around whenever I have the time but end up hitting road blocks.
I'll take a look at the links you posted, but alas, as you pointed out, I do not have the time to invest in learning a decent amount of COM.
Last edited on
A really good book on ATL is Andrew Troelsen's "Developer's Workshop To COM And ATL 3.0". At least I think its good. It is old though, and I'm not sure if there are newer ATL books out there. I know there is an ATL implementation in my VS 2008.

WebJose recommends Don Box's book. That is a highly recommended book and I have it too; I just haven't used that one to the extent I have these two...

"Inside COM" by Dale Rogerson

and

"Inside DCOM" by Guy And Henry Eddon.

One thing seldom covered in the COM documentation is building visual controls from scratch. That's what I like to do. Generally the accpted technique is to use ATL to construct the framework, but I personally hate that as I like to understand how things work. Can you believe I've never played a computer game? I get all the entertainment I need trying to figure these things out. So if you have any questions about it, I'd be glad to help. If you get stuck in ATL wizard type questions though, I'm likely not the best person to ask about that as I don't use the ATL templates hardly at all.

From what I've been able to gleeen so far from all the stuff leaking out about the upcomming Win 8 WinRT (Windows 8 Runtime), COM is the basis of it all. They've added another base interface to all objects named IInspectable. So knowing some COM might be good.

Good luck!

Topic archived. No new replies allowed.