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

隨筆 - 42  文章 - 3  trackbacks - 0
<2012年3月>
26272829123
45678910
11121314151617
18192021222324
25262728293031
1234567

常用鏈接

留言簿(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 鷹擊長空 閱讀(1253) 評論(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>
            欧美日韩在线另类| 久久久青草青青国产亚洲免观| 亚洲欧美日韩在线一区| 亚洲影院色在线观看免费| 国产欧美日韩亚洲一区二区三区| 老司机免费视频一区二区三区| 亚洲乱码国产乱码精品精| 久久久五月天| 久久亚洲综合色| 久久久综合激的五月天| 亚洲国产精品黑人久久久| 国产一区二区三区成人欧美日韩在线观看 | 国产精品一区免费观看| 欧美日本国产精品| 欧美资源在线观看| 久热精品在线视频| 欧美日韩国产成人高清视频| 欧美成ee人免费视频| 欧美精品日韩www.p站| 欧美人交a欧美精品| 欧美日韩国产成人在线免费| 欧美日韩在线视频一区二区| 欧美日韩综合| 国产在线高清精品| 999亚洲国产精| 亚洲成人原创| 亚洲一区免费视频| 欧美在线免费视频| 欧美激情视频一区二区三区不卡| 亚洲国产高清一区| 亚洲一区二区高清视频| 日韩一级欧洲| 久久久久在线观看| 国产精品―色哟哟| 日韩午夜在线电影| 毛片一区二区三区| 亚洲大胆人体在线| 亚洲电影免费在线观看| 国产精品久久久久久久久久直播| 欧美一区二区精美| 亚洲福利在线视频| 欧美中在线观看| 亚洲黄色免费网站| 在线视频精品一区| 欧美成人精品不卡视频在线观看| 久久精品九九| 欧美三级在线| 国产乱子伦一区二区三区国色天香| 一区二区三区在线观看国产| 亚洲一区二区精品在线| 欧美国产1区2区| 久久精品盗摄| 国产欧美日韩另类一区| 亚洲一区二区三区在线| 欧美一区三区二区在线观看| 欧美精品v国产精品v日韩精品| 亚洲激情欧美激情| 亚洲精品黄网在线观看| 欧美成人午夜剧场免费观看| 欧美在线视频一区| 伊人色综合久久天天| 噜噜爱69成人精品| 欧美韩日一区二区| 亚洲免费婷婷| 乱人伦精品视频在线观看| 一区二区三区久久| 亚洲影院免费观看| 亚洲电影在线免费观看| 亚洲精品国产精品国自产观看浪潮| 欧美久久视频| 久久一本综合频道| 欧美噜噜久久久xxx| 欧美在线91| 久久综合99re88久久爱| 亚洲精品免费看| 亚洲精品视频中文字幕| 久久尤物视频| 久久综合色影院| 国产日韩欧美| 欧美成人自拍| 国产精品爱久久久久久久| 久久午夜精品| 欧美国产高清| 性欧美长视频| 亚洲大胆在线| 欧美精品激情blacked18| 亚洲一区二区三区777| 一本色道久久精品| 激情伊人五月天久久综合| 欧美韩日一区| 狠狠色丁香久久婷婷综合丁香| 在线亚洲精品| 亚洲手机成人高清视频| 免费亚洲电影在线| 欧美激情按摩在线| 国产精品欧美日韩一区| 欧美~级网站不卡| 国产精品久久久久久久久动漫 | 久久亚洲高清| 亚洲视频一区二区| 麻豆av福利av久久av| 亚洲伊人伊色伊影伊综合网| 蜜桃视频一区| 亚洲二区精品| 亚洲中字在线| 久久人人爽人人爽| 欧美一区二区国产| 久久午夜视频| 国产色综合网| 久久亚洲精品欧美| 久久黄色小说| 欧美少妇一区二区| 欧美视频一区在线| 国产亚洲毛片在线| 亚洲人成网在线播放| 一本一本久久a久久精品综合麻豆 一本一本久久a久久精品牛牛影视 | 国产日韩视频| 欧美精品一区二区久久婷婷| 欧美大秀在线观看| 久久精品视频va| 久久亚洲图片| 麻豆精品精华液| 欧美区视频在线观看| 国产精品a久久久久| 欧美日韩一区不卡| 国产欧美va欧美va香蕉在| 国产精品入口麻豆原神| 红桃视频一区| 亚洲图片欧洲图片日韩av| 久久国产精品高清| 日韩亚洲欧美中文三级| 欧美在线视频观看| 欧美午夜在线视频| 亚洲国产毛片完整版| 亚洲一区精品电影| 亚洲国产精品成人一区二区| 亚洲影院污污.| 欧美日韩1080p| 亚洲欧洲精品一区二区| 久久综合给合久久狠狠狠97色69| 国产精品女人毛片| a91a精品视频在线观看| 国产精品美女主播在线观看纯欲| 亚洲美女av网站| 一本色道久久加勒比88综合| 久久爱91午夜羞羞| 亚洲综合精品自拍| 国产精品va在线播放| 亚洲国产日韩欧美综合久久| 久久综合久久88| 欧美亚洲一区三区| 国产三区二区一区久久| 欧美中文字幕第一页| 欧美中文字幕在线| 亚洲国产黄色| 亚洲欧洲一区二区天堂久久| 美日韩精品视频免费看| 亚洲国产另类久久精品| 欧美成人免费网| 欧美区日韩区| 久久精品国产精品亚洲精品| 久久精品一区二区三区不卡| 亚洲国产精品电影在线观看| 亚洲国产精品一区制服丝袜| 国产精品porn| 猛男gaygay欧美视频| 欧美日韩一二三区| 嫩模写真一区二区三区三州| 欧美日韩日本国产亚洲在线| 久久米奇亚洲| 国产精品国产亚洲精品看不卡15| 久久久www| 欧美日韩一区二区免费在线观看| 欧美在线视频全部完| 欧美日韩精品国产| 亚洲国产精品久久久久秋霞不卡| 国产精品一区在线观看你懂的| 亚洲高清视频一区| 国产一区二区看久久| 亚洲午夜电影网| 99国产精品国产精品久久| 玖玖玖国产精品| 久久国产欧美日韩精品| 欧美日韩18| 亚洲精品中文字幕在线观看| 精品动漫一区| 久久亚洲精品视频| 久久久久久亚洲综合影院红桃 | 日韩一区二区久久| 久久亚洲美女| 久久人人爽人人爽| 国产精品嫩草影院av蜜臀| 亚洲老板91色精品久久| 在线视频亚洲欧美| 国产精品久久久久永久免费观看| 久久久青草青青国产亚洲免观| 9色精品在线| 欧美日韩国产欧| 亚洲一区二区三区在线看| 亚洲影视在线播放|