COM、COM+、DCOM,从哪里开始?

发布于 2024-07-21 00:38:13 字数 209 浏览 3 评论 0原文

我对 COM+、DCOM 很好奇。 我知道 MSFT 不鼓励您本地使用这些工具(指的是 C/C++,实际上没有很多可用的文档),但我想学习使用这些技术,例如将 Internet Explorer 嵌入到 C 程序中。

我想也许我可以找到使用此技术或了解此技术的人。

从哪儿开始? 有任何想法吗? 有什么例子吗(比如 Hello World DCOM)?

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)?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

甜点 2024-07-28 00:38:13

如果你认真学习COM,Don Box的《Essential COM》绝对是一本绝对的“必读”。 COM 可能会令人困惑,以我的拙见,Don Box 是少数几个真正“理解”它的人之一。

“Essential COM”中的示例代码是用 C++ 编写的。 你不会找到很多支持用 C 语言编写 COM 的书。你可以用 C 语言编写 COM,但这会非常非常痛苦。 COM 针对 C++ 开发进行了优化。

这本书并不完美,也不“完整”。 这本书略过了一些(当然,有点深奥的)领域。 例如,这本书有大约 1 1/2 页是关于“绰号”的(我从未见过令我满意的绰号处理方式)。 我认为这本书是基础书。

其次,在现实生活中,您可能想要使用 ATL 等支持库,而不是直接编写所有 COM 胶水。 即使在基本设置中,COM 中也有很多方法会犯一些细微的错误。 ATL 会给你好的模式并为你实现枯燥的代码。 在学习中,你最好使用纯 C++。

关于ATL的书有很多,其中有几本相当不错。 我知道 ATL 自 VC++6 的旧时代以来已经发生了很大的变化,但我没有第一手的知识:遗憾的是,我使用的大多数 COM 代码永远锁定在 VC6 中的 C++ 风格。

确保您获得的任何书籍都是针对您计划使用的 Visual Studio 和/或 ATL 版本编写的。

COM 书籍的一些背景:

请注意,有很多书籍误解了 COM,或者关注了错误的事物。 老书在这方面表现更差。 前几本书中的一些书将 COM 视为使 OLE 工作所需的管道细节(“对象链接和嵌入”,这使您可以将电子表格范围拖放到 Word 文档中)。 正因为如此,很多材料都非常令人困惑。 人们花了一段时间才意识到 OLE 并不那么重要,而 COM 才真正重要。

当 Don Box 发表“Essential COM”时,COM 基础上的裂痕已经开始变得明显。 COM 并没有什么严重的缺陷,但是开发社区的需求已经发展并超出了 COM 在不进行认真修改的情况下所能完成的功能。

.NET 的诞生是为了解决 COM 的局限性,特别是在“类型信息”领域。 “Effective COM”发布几年后,社区的注意力就转移到了 .NET。 因此,好的 COM 培训材料现在并且很可能永远是有限的。

因此,COM 并没有被破坏,而且它非常适合它的用途(这就是 Explorer 仍然使用它的原因)。 对于当今需要解决的许多问题来说,它不再是最佳解决方案。

总之:

我推荐“Essential COM”作为基础知识。 然后,可以使用许多优秀的 ATL 书籍中的任何一本(没有强烈的偏好),然后使用其他资源(例如 MSDN 或 — 当然 — Stack Overflow)来涵盖您特别感兴趣的领域。

如果您不想依赖死树资源,请继续从网络学习 ATL。 但有些书值得以老式的方式阅读——《Essential COM》就是其中之一。

祝你好运。

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.

冷清清 2024-07-28 00:38:13

COMCOM+DCOM 是三个完全不同的东西。 此时,几乎没有理由学习 COM,几乎没有理由学习 DCOM。 我能想到的唯一原因是您是否必须维护或集成遗留组件。 COM+ 仍然被使用,因为它允许进程外托管组件和分布式事务管理等好东西。

开始编写 COM 的最佳方法是使用 ATL。 在 .NET COM+ 中称为企业服务

我知道的关于 COM 的最好的书是 Don Box 的 Essential COM 和 Tim Ewald 的 COM+ 书也很棒。

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.

层林尽染 2024-07-28 00:38:13

我编制了一份书籍清单,应按以下顺序阅读:

  1. Dale Rogerson 的《Inside COM》,这应该是您的第一本书。 它解释了引用计数、接口、IUnknown、组件、idl、IDispatch、自动化类型和单元的基础知识。 从本书中您会注意到,制作组件需要相当多的代码,并且您可以轻松地跳过“发布”,这会导致资源泄漏。 这本书还缺乏一些细节。
  2. 塔瓦雷斯的“ATL 内部结构”。 ATL 帮助您在客户端使用和制作 COM 组件。 有了智能指针(例如CComPtr),现在很难让引用计数出错。 ATL 还有助于用 C++ 制作组件。 不幸的是,ATL 在宏中隐藏了许多功能,并且有一种违反直觉的方法来实现 IUnknown。 另一种选择可能是“Inside ATL”。
  3. Don Box 的“基本 COM”。 这本书经常被提及,但它不是一本好的初学者书籍。 它错过了整体情况,但在细节上却很出色(例如 idl 中“size_is”和“length_is”之间的差异)。
  4. “了解 ActiveX 和 OLE:开发人员和管理人员指南”。 本书涉及一些更深奥的接口,例如 IPersist、IStorage; IMoniker 等,但没有详细介绍。

请注意,COM 在某种程度上是一项旧技术,但仍然可行,特别是对于本机开发人员而言。

I compiled a list of books, which should be read in this order:

  1. 'Inside COM' from Dale Rogerson, This should be your first book. It explains the basics of reference counting, interfaces, IUnknown, components, idl, IDispatch, automation types and apartments. From this book you will notice that it takes quite some code to make components and that you can easily skip a 'Release', which leads to resource leaking. Also this books lacks some details.
  2. 'ATL Internals' from Tavares. ATL helps you with both client use as making COM components. With smart pointers (e.g. CComPtr) it's hard to get the reference counting wrong these days. ATL also facilitates in making components in c++. Unfortunately ATL hides many functionality in macro's and has a counter intuitive way to implement IUnknown. An alternative might be 'Inside ATL'.
  3. 'Essential COM' from Don Box. This book is mentioned frequently but it is not a good beginners book. It misses the overall picture, but is great in its details (e.g. the difference between 'size_is' and 'length_is' in idl).
  4. 'Understanding ActiveX and OLE: A Guide for Developers and Managers'. This books touches some of the more esoteric interfaces like IPersist, IStorage; IMoniker etc., but does not go into great detail.

Be aware that COM is somewhat of an old technology, though still viable especially for native developers.

甩你一脸翔 2024-07-28 00:38:13

如果您想要使用或扩展各种 Windows API(例如 shell 扩展、脚本主机等),COM 仍然很有用。

Essential COM (Box) 和 ATL Internals (Rector 和 Sells) 都是极好的来源。 有效的COM(Box等)也可以。

如果您确实想要了解 COM 的完整情况,请尝试获取一份巨大的 Inside OLE (Brockschmidt) 的副本。

分布式 COM(Eddon、Eddon)在 DCOM 上表现不错,内部 COM+ 基础服务(Eddon、Eddon)在 COM+ 上也很不错。

甚至一些所谓的“纯”C++ 书籍中也有有关 COM 的内容。 Matthew Wilson 的《Imperfet C++》有一些有用的部分,可以帮助您了解它的内部工作原理,他的《扩展 STL》书中有几章介绍如何使 COM 适应 STL 集合。

如果您想了解有关如何编写 COM 服务器的更多信息,您可能需要深入了解 ATL。 前面提到的ATL Internals 是必须的。 尽管标题听起来很不起眼,《Beginning ATL COM》中也有一些有用的东西。

将 COM 与 .NET 进行对比也可能对学习过程有所帮助。 .NET 和 COM 互操作性手册是一本大书,但其中有一些有用的东西。 另外,我会查看 Shared Source CLI Essentials,只是为了帮助对比这两种技术。

华泰

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

葬心 2024-07-28 00:38:13

从“Inside COM”开始,然后转到“Inside DCOM”,然后阅读“Essential COM”。 您将掌握 COM。 Inside COM 和 Inside DCOM 这两本书都是 Microsoft 出版物。 对于想要彻底了解 COM/DCOM 的人来说是一本很棒的书。

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.

岛徒 2024-07-28 00:38:13

Essential COM 特别适用于从 C++ 实现或使用 COM 组件,无需使用 IDE、框架或库来提供帮助。

例如,从 VB 或 Delphi 中使用 COM 很简单,这对应用程序程序员隐藏了 COM 特定的粘合性。 在 C++ 中,您经常使用一些试图抽象细节的类库...Essential COM 会告诉您这些细节是什么(并且在这样做时实现了自己的库/框架)。

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).

千と千尋 2024-07-28 00:38:13

实际上,如果您想了解有关 COM 的更多信息,Microsoft 出版了一本有关 COM 及其工作原理的书... http://www.amazon.com/Inside-Microsoft-Programming-Dale-Rogerson/dp/1572313498/ref=sr_1_2?ie=UTF8&s=books&qid=1243029018&sr=8-2< /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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文