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

隨筆 - 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 鷹擊長空 閱讀(1248) 評論(0)  編輯 收藏 引用
青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <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>
            亚洲精品视频在线观看免费| 国产精品推荐精品| 亚洲理伦在线| 日韩视频免费| 一区二区三区四区国产| 在线视频中文亚洲| 亚洲一区中文| 久久久91精品国产一区二区精品| 久久久精品久久久久| 另类成人小视频在线| 欧美激情bt| 国产目拍亚洲精品99久久精品| 国产日韩欧美在线播放| 国产在线欧美日韩| 亚洲激情在线观看视频免费| 夜夜爽www精品| 欧美中文字幕第一页| 欧美xart系列高清| 日韩视频中文字幕| 国产麻豆91精品| 亚洲区第一页| 亚洲精品久久久久中文字幕欢迎你| 一区二区三区精品久久久| 性亚洲最疯狂xxxx高清| 欧美大片va欧美在线播放| 99精品国产高清一区二区| 久久精品视频亚洲| 国产精品成人一区二区艾草| 激情久久久久久| 亚洲一区二区三区四区在线观看| 久久一本综合频道| 亚洲桃色在线一区| 欧美aaa级| 国产一区美女| 亚洲欧美成人一区二区三区| 免费一级欧美片在线观看| 亚洲一区二区三区在线视频| 欧美第十八页| 在线观看国产欧美| 欧美伊人精品成人久久综合97| 亚洲激情视频在线播放| 亚洲性图久久| 欧美精品一区二区三区久久久竹菊 | 欧美在线不卡| 欧美视频一区二区三区在线观看| 亚洲国产精品久久久久秋霞不卡 | 亚洲精品美女久久久久| 久久免费国产| 国产一区二区三区高清播放| 亚洲一区一卡| 亚洲另类春色国产| 欧美大片免费观看| 最新日韩av| 欧美激情 亚洲a∨综合| 久久亚洲影院| 亚洲成人在线免费| 蜜臀久久99精品久久久久久9 | 久久久久久有精品国产| 国产一区二区电影在线观看| 欧美淫片网站| 欧美一区二区成人6969| 国产一区导航| 久久天堂av综合合色| 久久精品视频在线看| 红桃av永久久久| 蜜臀av在线播放一区二区三区| 久久精品99久久香蕉国产色戒| 国产综合久久| 免费在线国产精品| 久久综合色天天久久综合图片| 亚洲电影激情视频网站| 亚洲欧美久久久| 在线观看精品| 欧美成人性网| 欧美精品成人| 亚洲欧美激情视频| 性做久久久久久久免费看| 国内精品久久久久影院 日本资源 国内精品久久久久伊人av | 欧美aⅴ99久久黑人专区| 日韩亚洲精品电影| 亚洲视频www| 韩国av一区二区三区在线观看| 久久夜色精品| 欧美精品激情在线观看| 午夜久久黄色| 另类亚洲自拍| 亚洲一区二区三区精品动漫| 午夜精品久久久久久| 亚洲第一天堂av| 一区二区高清视频在线观看| 国产真实乱子伦精品视频| 最新国产の精品合集bt伙计| 国产精品久线观看视频| 老司机成人网| 欧美亚州在线观看| 老司机免费视频久久| 欧美精品日韩| 久久永久免费| 欧美视频专区一二在线观看| 久久久欧美精品sm网站| 欧美日韩一区二区在线视频| 久久久久久久综合狠狠综合| 欧美精品性视频| 狂野欧美激情性xxxx欧美| 欧美日韩中国免费专区在线看| 久久综合给合| 国产精品高潮呻吟久久av无限 | 亚洲品质自拍| 亚洲欧美成aⅴ人在线观看| 亚洲欧洲精品天堂一级| 午夜伦理片一区| 一本大道久久精品懂色aⅴ| 欧美一区二区精美| 亚洲视频第一页| 美女尤物久久精品| 久久国产免费看| 欧美日韩三级电影在线| 欧美成人综合网站| 国产又爽又黄的激情精品视频 | 亚洲视频欧美视频| 最新亚洲一区| 蜜桃av一区| 老司机67194精品线观看| 国产精品网站在线观看| avtt综合网| 亚洲精品久久久久久一区二区| 久久精品卡一| 久久久久久高潮国产精品视| 性欧美18~19sex高清播放| 亚洲欧美怡红院| 午夜精品久久一牛影视| 欧美日韩在线免费观看| 日韩视频免费观看| 亚洲精品国偷自产在线99热| 免费不卡在线观看| 蜜臀91精品一区二区三区| 国产日产精品一区二区三区四区的观看方式 | 韩国三级在线一区| 欧美一区二区三区四区在线观看| 亚洲欧美中文日韩在线| 国产精品久久久久久久久免费| 日韩视频在线一区| 亚洲综合色视频| 国产精品区一区二区三| 亚洲一区综合| 久久永久免费| 亚洲精选视频免费看| 欧美精品综合| 亚洲视频axxx| 久久久xxx| 亚洲高清在线观看一区| 欧美福利在线| 亚洲视频一起| 久久蜜桃资源一区二区老牛 | 欧美伊人久久| 一区二区亚洲| 欧美国产激情二区三区| 99精品免费| 久久国产日韩| 91久久中文字幕| 欧美日韩午夜剧场| 欧美一级夜夜爽| 欧美激情一区二区在线| 亚洲天堂av在线免费观看| 国产视频久久网| 美女尤物久久精品| 亚洲视频碰碰| 欧美bbbxxxxx| 亚洲免费一区二区| 激情一区二区| 国产精品99免费看| 久久久欧美精品sm网站| 亚洲毛片播放| 久久综合九色| 亚洲免费视频一区二区| 一区二区三区在线视频播放| 欧美日韩中文| 猛干欧美女孩| 欧美亚洲免费在线| 亚洲精品视频一区| 欧美~级网站不卡| 亚洲女人天堂av| 最近中文字幕日韩精品| 国产精品入口尤物| 欧美精品日韩| 麻豆亚洲精品| 99v久久综合狠狠综合久久| 亚洲第一区在线| 欧美色123| 久久美女性网| 亚洲欧美韩国| 亚洲美女视频在线观看| 欧美成人精品福利| 久久久久九九九九| 亚洲网站在线播放| 亚洲人屁股眼子交8| 精品成人a区在线观看| 国产伦精品一区二区| 欧美三区免费完整视频在线观看| 免费观看久久久4p|