tags:

views:

1031

answers:

6

I am curious about COM+, DCOM. I know that MSFT does not encourage you to use this tools natively (meaning with C/C++, in fact there is not a lot of documentation available) but I want to learn to use these technologies, like embedding Internet Explorer into a C program.

I thought that maybe I could find people that worked with this or that knows about this technology.

Where to start? Any ideas? Any example (like Hello World DCOM)?

+1  A: 

Actually, if you want to learn more about COM, Microsoft publishes a book about COM and how it works... http://www.amazon.com/Inside-Microsoft-Programming-Dale-Rogerson/dp/1572313498/ref=sr_1_2?ie=UTF8&s=books&qid=1243029018&sr=8-2

McWafflestix
Is this State of the art? It seems kind of old.
Franco
COM is old. For the past 8 years, all the Microsoft Press stuff has been about .NET.
Cheeso
@Cheeso is right; COM is an old technology. Microsoft is focusing on .NET for most of its new development, but COM development is still completely valid; it's just that most of the references you'll find on it will be a bit old.
McWafflestix
"Inside COM" is a great book. I read several COM books when COM was hot, and that was the book made most sense. Don Box's "Essential COM" would be a good *second* book to read, but it contains too much detail. "Inside COM" is easier to start with and covers the main points. (I don't think everything in "essential" COM is essential!)
John D. Cook
+3  A: 

COM, COM+ and DCOM are three completely different things. At this point, there is very little reason to learn COM and almost no reason to learn DCOM. The only reason I can think of is if you have to maintain or integrate legacy components. COM+ is still used because it allows for out of process hosting of components and nice things like distributed transaction management.

The best way to start writing up some COM is using ATL. In .NET COM+ is called Enterprise Services.

The best book I know on COM is Don Box's Essential COM and Tim Ewald's COM+ book is excellent too.

JP Alioto
+1 for "there is very little reason to learn COM", -1 for suggesting ATL to newbies. Evens out :)
Andomar
@Andomar: lol, I know it's ridiculous. :)
JP Alioto
+1  A: 

COM is still useful if you want to work with, or extend, various Windows APIs, such as shell extensions, scripting host, and so on.

Essential COM (Box) and ATL Internals (Rector and Sells) are excellent sources. Effective COM (Box, et al) is also ok.

If you really want the full picture on COM, try and get a copy of the immense Inside OLE (Brockschmidt).

Distributed COM (Eddon, Eddon) is decent on DCOM, as is Inside COM+ Base Services (Eddon, Eddon) on COM+.

even some supposedly "pure" C++ books have bits on COM in them. Matthew Wilson's Imperfet C++ has some useful parts for seeing how it works on the inside, and his Extended STL book has a couple of chapters on how to adapt COM to STL collections.

If you want to know more about how to write COM servers, you'll probably need to bone up on ATL. The aforementioned ATL Internals is a must. Despite its humble sounding title, Beginning ATL COM has some useful stuff in it too.

Also helpful in the learning process might be to contrast COM with .NET. The .NET and COM Interoperability Handbook is a big swallow, but has some useful stuff in it. Also, I would check out Shared Source CLI Essentials, just to help contrast the two technoloqies.

HTH

DannyT
>Essential COM (Box, et al) is also ok...You mean "Effective COM" for your second entry, right?
Euro Micelli
Other way round. Thanks for spotting it.
DannyT
Euro Micelli
Sorry. Slow day. Fixed now.
DannyT
+1  A: 

Essential COM is especially for implementing or using COM components from C++, without using an IDE, framework, or library to help.

COM is trivial to use from VB or from Delphi, for example, which hide the COM-specific glue from the application programmer. In C++ you'd often use some class library that tries to abstract the details ... Essential COM will tell you what those details are (and kind of implements its own library/framework in doing so).

ChrisW
+9  A: 

If you are serious about learning COM, Don Box's "Essential COM" is definitely an absolute "must read". COM can be confusing and in my humble opinion Don Box is one of the few people who actually "got it".

The example code in "Essential COM" is in C++. You won't find many books that support COM in C. You can write COM in C, but it will be very, very painful. COM is optimized for C++ development.

This book is not perfect nor "complete". There are some (granted, a bit esoteric) areas that the book skims over. For example, the book has like 1 1/2 pages on "monikers" (I have never seen a treatment of monikers that satisfies me). I consider this book to be THE fundamental book.

Second, in real life you are likely to want to use a supporting library such as ATL, rather than writing all the COM glue directly. There are too many ways to make subtle mistakes in COM even in the basic set up. ATL will give you good patterns and implement the boring code for you. In learning, you are better off using plain C++.

There are many books about ATL and several are quite good. I understand that ATL has changed quite a bit since the old days of VC++6, but I don't have first hand knowledge there: sadly, most of the COM code I work with is forever locked to the flavor of C++ in VC6.

Make sure whatever book you get is written for the version of Visual Studio and/or ATL you are planing on using.

Some background on COM books:

Note that there are a lot of books out there that misunderstand COM, or focus on the wrong things. The older books are worse in this respect. Some of the first few books treated COM as little more than a plumbing detail needed to make OLE work ("Object Linking and Embedding", that's what allows you to drag-and-drop a spreadsheet range into a Word document). Because of that, a lot of the material out there is very confusing. It took a while before people realized that OLE wasn't that important and that COM really was.

By the time Don Box published "Essential COM", the cracks on the foundation of COM had started to become evident. There isn't anything terribly flawed with COM, but the needs of the development community had evolved and outgrown what COM could do without serious revamping.

.NET was born out of that effort to address the limitations in COM, especially in the area of "type information". Just a few years after "Effective COM" was published, the attention of the community shifted away to .NET. Because of that, good COM training material is now and will likely remain forever limited.

So, COM is not broken, and it works great for the things it's used for (that's why Explorer still uses it). It's just not the best solution anymore for many of the problems that need solving today.

In summary:

I recommend "Essential COM" for the basics. Then, any of many good ATL books available (no strong preferences there), and then use other resources like MSDN or -- of course -- Stack Overflow, to cover areas that are of particular interest to you.

If you'd rather avoid relying on resources of the dead-tree variety, go ahead and learn ATL from the web. But some books are worth reading the old fashioned way -- and "Essential COM" is one of them.

Good luck.

Euro Micelli
+1  A: 

Start with "Inside COM", then move on to "Inside DCOM" and then read the "Essential COM". You will get a grip on COM. Both the books Inside COM and Inside DCOM are Microsoft Publications. Excellent books for the one who wants to know COM/DCOM thoroughly.