青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

隨筆 - 42  文章 - 3  trackbacks - 0
<2010年2月>
31123456
78910111213
14151617181920
21222324252627
28123456
78910111213

常用鏈接

留言簿(2)

隨筆檔案

文章檔案

網頁收藏

搜索

  •  

最新評論

閱讀排行榜

評論排行榜

Recently, I have read Inside COM, it is not my first time to read it. But still I got some useful information from it.

First of all, rather than inheriting, Containment and Aggregation are the two methods COM used to achieve reusability.
Aggregation is the specialized form of Containment, in which the programmer doesn’t have to implement code in the outer component to forward/delegate a call to the inner component and hence makes the life of a programmer easier. In Aggregation, the outer component hands over the control of the interface, which is being implemented by the inner component, to the client directly and the outer component gets out of the picture. In Aggregation, the interface to the inner component is exposed directly to the client, which is in contrast with the Containment. The outer IUnknown and the Inner IUnknown will be having the different implementation of the QueryInterface and hence it violates the basic QueryInterface rules. To forward/delegate calls to the outer IUnknown, the inner component needs the outer component’s IUnknown interface pointer. The outer component passes its IUnknown interface pointer at the time of creating the inner component. The outer component calls CoCreateInstance and passes its IUnknown pointer in the second argument of CoCreateInstance. If this parameter is non-NULL, then the component is being aggregated, otherwise the component is not aggregated.

Secondly, The IDispatch interface was initially designed to support Automation. It provides a late-binding mechanism to access and retrieve information about an object's methods and properties.In addition to the methods inherited from IUnknown, server developers must implement the following methods within the class definition of each object that is exposed:
  • GetTypeInfoCount returns the number of type descriptions for the object. For objects that support IDispatch, the type information count is always one.
  • GetTypeInfo retrieves a description of the object's programmable interface.
  • GetIDsOfNames maps the name of a method or property to a DISPID, which is later used to invoke the method or property.
  • Invoke calls one of the object's methods, or gets or sets one of its properties.

When the client need to call the method provide by the server, and the code is like this:

 

 1HRESULT hret=CoInitialize(NULL); assert(SUCCEEDED(hret));
 2    CComPtr<IDispatch> ptr;
 3
 4    ptr.CoCreateInstance(L"InternetExplorer.Application");
 5      if(ptr==0{ wprintf(L"Unable to create Application\n"); return 1; }
 6    
 7    wchar_t *array=L"GoHome";
 9    long id;
10    hret=ptr->GetIDsOfNames(IID_NULL,&array,1,LOCALE_SYSTEM_DEFAULT,&id);
11    assert(SUCCEEDED(hret));
12    
13    DISPPARAMS noparams;  memset(&noparams,0,sizeof(noparams));
14    
15    hret=ptr->Invoke(id,IID_NULL,LOCALE_SYSTEM_DEFAULT,DISPATCH_METHOD,&noparams,NULL,NULL,NULL);   
18    CoUninitialize();    return 0;
19

Third, Connection Points, Com’s Observer Pattern
-Based on Callbacks
-COM-Object can have one or more event sources
-Per event source may be one or more subscribed event sink
-asynchronous communication between a server and its clients

//Client
class myEventSink : public EventSink
{
 void handleEvent(int arg)
 { cout << “myEventHandler” << arg << endl; }
};

//Server
[ object, uuid(…) }
interface IEventSource : IUnknown
{
 HRESULT Attach( [in] IEventSink* PEveSink);
};

Protocol
IConnectionPointContainer::FindConnectionPoint
IConnectionPoint::Advise       //passing sink interface pointer, receiving cookie
IConnectionPoint::Unadvice    //terminates notification

 

posted on 2012-03-04 22:08 鷹擊長空 閱讀(1255) 評論(0)  編輯 收藏 引用

只有注冊用戶登錄后才能發表評論。
網站導航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            国产精品视频久久| 欧美日韩国产区| 激情综合在线| 欧美成人国产一区二区| 美女脱光内衣内裤视频久久影院| 亚洲国产福利在线| 久久亚洲色图| 一区二区三区高清不卡| 欧美第十八页| 欧美人成免费网站| 亚洲一二区在线| 亚洲欧美精品在线观看| 极品裸体白嫩激情啪啪国产精品| 亚洲韩日在线| 亚洲国产另类久久精品| 欧美精品成人一区二区在线观看| 国产精品美女久久久| 午夜精品国产更新| 久久精品成人一区二区三区蜜臀 | 欧美一区二区三区免费观看视频| 欧美在线1区| 亚洲精品国产系列| 亚洲性视频网址| 亚洲第一色在线| 亚洲精品你懂的| 国产精品日韩精品| 欧美成人网在线| 国产精品久久国产愉拍| 美日韩精品视频| 欧美日韩激情网| 欧美1区视频| 国产精品久久久久久五月尺| 久久人人超碰| 国产精品久久久久久av福利软件| 亚洲人成在线观看网站高清| 亚洲午夜高清视频| 亚洲电影网站| 亚洲欧美成人在线| 一本色道**综合亚洲精品蜜桃冫 | 欧美在线观看日本一区| 免费观看成人| 久久都是精品| 欧美久久婷婷综合色| 久久久人成影片一区二区三区| 日韩小视频在线观看专区| 尹人成人综合网| 亚洲视频每日更新| 亚洲精品久久久久久久久久久久 | 亚洲无限乱码一二三四麻| 亚洲国产免费看| 欧美在线视频观看| 午夜精品网站| 欧美三级黄美女| 91久久精品一区二区别| 国内精品久久久久影院色 | 欧美一级免费视频| 欧美日韩四区| 亚洲精品欧美专区| 亚洲精品色婷婷福利天堂| 久久人91精品久久久久久不卡| 精品999在线观看| 亚洲欧美一区二区三区久久| 亚洲综合第一页| 国产精品久久77777| 亚洲精品在线一区二区| 日韩午夜电影| 欧美日韩视频免费播放| 亚洲精品一区二区三区四区高清| 欧美午夜美女看片| 日韩午夜av| 亚洲影院色在线观看免费| 欧美日韩在线一区二区| 一本色道久久综合亚洲二区三区| 国产日韩在线看| 久久国产精品99久久久久久老狼| 在线日韩av片| 欧美黑人一区二区三区| 亚洲乱码国产乱码精品精| 亚洲免费大片| 国产精品久久久久久久第一福利 | 亚洲美女黄网| 欧美理论在线播放| 亚洲一区免费看| 亚洲欧美欧美一区二区三区| 国产日韩欧美在线| 久久久久久国产精品mv| 亚洲高清不卡| 亚洲免费在线播放| 国产一区二区高清视频| 免费欧美在线视频| 在线视频欧美日韩| 久久琪琪电影院| 日韩午夜免费视频| 国产精品免费视频观看| 久久免费少妇高潮久久精品99| 亚洲一区二区网站| 国产一区二区三区久久| 欧美激情国产高清| 午夜亚洲福利在线老司机| 欧美高清不卡| 欧美在线电影| 日韩图片一区| 伊人婷婷欧美激情| 欧美日韩卡一卡二| 欧美一区二区三区在线视频 | 国产嫩草一区二区三区在线观看 | 亚洲网站啪啪| 国产一区二区电影在线观看| 欧美激情精品久久久久久| 一区二区三区视频在线看| 久久久午夜视频| 亚洲一区二区三区精品视频| 尤物在线精品| 国产精品一区久久久| 欧美激情一区二区三区蜜桃视频| 女同一区二区| 久久成人在线| 在线综合欧美| 亚洲国产精品v| 国产亚洲精品激情久久| 欧美日韩视频免费播放| 开心色5月久久精品| 欧美专区在线观看一区| 亚洲桃花岛网站| 亚洲人成高清| 欧美激情一区二区在线 | 精品成人在线观看| 国产精品美女久久久久久久| 欧美国产在线电影| 裸体一区二区三区| 久久电影一区| 亚洲免费视频观看| 在线亚洲激情| 在线视频精品| 一区二区av在线| 99pao成人国产永久免费视频| 亚洲私人影吧| 一区二区免费在线观看| 亚洲精品久久久久久下一站 | 国产精品成人一区二区| 欧美国产极速在线| 欧美成人午夜激情视频| 免费成人小视频| 蜜臀久久久99精品久久久久久| 亚洲人成绝费网站色www| 男男成人高潮片免费网站| 欧美在线视频一区| 欧美一区精品| 久久精品道一区二区三区| 久久国产免费看| 久久九九有精品国产23| 久久久夜色精品亚洲| 久久久久国产精品一区三寸| 久久精品首页| 欧美成人精品一区二区三区| 欧美激情精品久久久六区热门 | 久久久久久久精| 久久久久久久综合色一本| 久久国产99| 牛牛国产精品| 99国内精品久久| 午夜激情综合网| 狂野欧美激情性xxxx| 欧美暴力喷水在线| 国产精品v欧美精品∨日韩| 国产精品久久久久久av福利软件 | 欧美专区亚洲专区| 久久久久国产精品人| 欧美成人高清视频| 欧美午夜视频在线| 国产一区二区激情| 亚洲伦理一区| 羞羞漫画18久久大片| 巨胸喷奶水www久久久免费动漫| 一区二区三区国产盗摄| 午夜精品免费视频| 欧美国产精品v| 亚洲伦理中文字幕| 欧美一区二区大片| 欧美国产第二页| 国产日韩高清一区二区三区在线| 欧美性大战久久久久久久蜜臀 | 亚洲一区精品电影| 久久久五月天| 国产精品久久激情| 影音先锋久久| 亚洲欧美一区二区原创| 欧美高清hd18日本| 先锋影音国产一区| 欧美人与性禽动交情品| 韩日欧美一区| 欧美一区二区三区免费视频| 欧美成人一区在线| 欧美一级视频免费在线观看| 欧美日韩国产免费| 亚洲人成网在线播放| 久久高清一区| 亚洲欧美成人一区二区三区| 欧美另类极品videosbest最新版本| 欧美成人国产一区二区|