﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-wuzhuohua</title><link>http://www.cppblog.com/wuzhuohua/</link><description /><language>zh-cn</language><lastBuildDate>Fri, 10 Apr 2026 10:41:59 GMT</lastBuildDate><pubDate>Fri, 10 Apr 2026 10:41:59 GMT</pubDate><ttl>60</ttl><item><title>Definitions of the Basic Elements with com</title><link>http://www.cppblog.com/wuzhuohua/archive/2008/11/12/66694.html</link><dc:creator>wuzhuohua</dc:creator><author>wuzhuohua</author><pubDate>Wed, 12 Nov 2008 03:37:00 GMT</pubDate><guid>http://www.cppblog.com/wuzhuohua/archive/2008/11/12/66694.html</guid><wfw:comment>http://www.cppblog.com/wuzhuohua/comments/66694.html</wfw:comment><comments>http://www.cppblog.com/wuzhuohua/archive/2008/11/12/66694.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/wuzhuohua/comments/commentRss/66694.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/wuzhuohua/services/trackbacks/66694.html</trackback:ping><description><![CDATA[<p>Let's go from the bottom up. An interface is simply a group of functions. Those functions are called methods. Interface names start with I, for example IShellLink. In C++, an interface is written as an abstract base class that has only pure virtual functions.</p>
<p>Interfaces may inherit from other interfaces. Inheritance works just like single inheritance in C++. Multiple inheritance is not allowed with interfaces.<br>Interfaces只能使用單inheritance.</p>
<p>A coclass (short for component object class) is contained in a DLL or EXE, and contains the code behind one or more interfaces. The coclass is said to implement those interfaces. A COM object is an instance of a coclass in memory. Note that a COM "class" is not the same as a C++ "class", although it is often the case that the implementation of a COM class is a C++ class.</p>
<p>coclass 組件對象類。存在于dll或者exe中。coclass可以包跨一個或者多個interfaces。<br>一個com對象是一個初始后在內存中的實例。</p>
<p>A COM server is a binary (DLL or EXE) that contains on or more coclasses.</p>
<p>A class ID, or CLSID, is a GUID that names a coclass. An interface ID, or IID, is a GUID that names an interface.<br>guid的兩用</p>
<p>An HRESULT is an integral type used by COM to return error and success codes. It is not a "handle" to anything, despite the H prefix. I'll have more to say about HRESULTs and how to test them later on.</p>
<p>Finally, the COM library is the part of the OS that you interact with when doing COM-related stuff. Often, the COM library is referred to as just "COM," but I will not do that here, to avoid confusion.<br>com library 是操作系統的一部分<br>&nbsp;</p>
<p>The Base Interface - IUnknown</p>
<img src ="http://www.cppblog.com/wuzhuohua/aggbug/66694.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/wuzhuohua/" target="_blank">wuzhuohua</a> 2008-11-12 11:37 <a href="http://www.cppblog.com/wuzhuohua/archive/2008/11/12/66694.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>com的客戶端，如何調用com的服務端的classfactory生成對象。</title><link>http://www.cppblog.com/wuzhuohua/archive/2008/11/06/66124.html</link><dc:creator>wuzhuohua</dc:creator><author>wuzhuohua</author><pubDate>Thu, 06 Nov 2008 06:51:00 GMT</pubDate><guid>http://www.cppblog.com/wuzhuohua/archive/2008/11/06/66124.html</guid><wfw:comment>http://www.cppblog.com/wuzhuohua/comments/66124.html</wfw:comment><comments>http://www.cppblog.com/wuzhuohua/archive/2008/11/06/66124.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/wuzhuohua/comments/commentRss/66124.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/wuzhuohua/services/trackbacks/66124.html</trackback:ping><description><![CDATA[com的服務器端的Iclassfactory的接口是用來產生對象的實例的接口，如果有（也必須有）一個class是由這個接口派生的,如果com對象是進程內組建對象的話，必須實現DllGetClassObject的方法。在client端通過CoCreateInstance，CoCreateInstanceEx,CoGetClassObject三種方法中的一個。把參數clisid，iid和ppv傳給DllGetClassObject方法。由DllGetClassObject創建類廠，并返回類廠對象接口指針。<br><br>CoCreateInstance，CoCreateInstanceEx,CoGetClassObject的區別。<br>CoGetClassObject 這個是最原始也是最基本的方法，他的參數包跨IID_IClassFactory.<br>CoCreateInstance&nbsp;比較常用的方法，參數使用IID_IUnknown,從而隱藏了IClassFactory的細節<br><br>CoCreateInstanceEx，使用了一個接口數組，因此可以返回多個接口。<br><br><br><br>&nbsp; 
<img src ="http://www.cppblog.com/wuzhuohua/aggbug/66124.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/wuzhuohua/" target="_blank">wuzhuohua</a> 2008-11-06 14:51 <a href="http://www.cppblog.com/wuzhuohua/archive/2008/11/06/66124.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>