一种全新的软件界面设计方法[3]

[入库:2005年8月18日] [更新:2007年3月24日]

本文简介:选择自 aweay 的 blog

helloworld就是我们扩展的一个方法,当点击按钮的时候external对象会调用helloworld方法调用本地代码,对于external对象则会调用上面提到的getexternal方法来查询是否提供了扩展,下面是如何实现getexternal方法来实现扩展external对象,代码如下:

class mydochandler :public idochostuihandler

{

  long refcount;

public:

  mydochandler() :refcount(1){ }

  virtual hresult stdmethodcalltype queryinterface(refiid classid, void** intf) {

    if (classid == iid_iunknown)

    {

      *intf = (iunknown*)this;

      addref();

    }

    else if (classid == iid_idochostuihandler)

    {

      *intf = (idochostuihandler*)this;

      addref();

    }

    else if (classid == iid_idispatch)

    {

      *intf = (idispatch*)this;

      addref();

    }

    else

      return e_nointerface;

    return s_ok;

  }

  virtual ulong stdmethodcalltype addref() {

    interlockedincrement(&refcount);

    return refcount;

  }

  virtual ulong stdmethodcalltype release() {

    interlockeddecrement(&refcount);

    if (refcount == 0)

      delete this;

    return refcount;

  }

  //返回s_ok,屏蔽掉右键菜单

  virtual hresult stdmethodcalltype showcontextmenu(

    /* [in] */ dword dwid,

    /* [in] */ point __rpc_far *ppt,

    /* [in] */ iunknown __rpc_far *pcmdtreserved,

    /* [in] */ idispatch __rpc_far *pdispreserved) {

        return s_ok;

    }

  virtual hresult stdmethodcalltype gethostinfo(

    /* [out][in] */ dochostuiinfo __rpc_far *pinfo) {

        return e_notimpl;

    }

  virtual hresult stdmethodcalltype showui(

    /* [in] */ dword dwid,

    /* [in] */ ioleinplaceactiveobject __rpc_far *pactiveobject,

    /* [in] */ iolecommandtarget __rpc_far *pcommandtarget,

    /* [in] */ ioleinplaceframe __rpc_far *pframe,

    /* [in] */ ioleinplaceuiwindow __rpc_far *pdoc) {

        return e_notimpl;

    }

  virtual hresult stdmethodcalltype hideui( void) {

        return e_notimpl;

    }

  virtual hresult stdmethodcalltype updateui( void) {

        return e_notimpl;

    }

  virtual hresult stdmethodcalltype enablemodeless(

    /* [in] */ bool fenable) {

        return e_notimpl;

    }

  virtual hresult stdmethodcalltype ondocwindowactivate(

    /* [in] */ bool factivate) {

        return e_notimpl;

    }

  virtual hresult stdmethodcalltype onframewindowactivate(

    /* [in] */ bool factivate) {

        return e_notimpl;

    }

  virtual hresult stdmethodcalltype resizeborder(

    /* [in] */ lpcrect prcborder,

    /* [in] */ ioleinplaceuiwindow __rpc_far *puiwindow,

    /* [in] */ bool framewindow) {

        return e_notimpl;

    }

  virtual hresult stdmethodcalltype translateaccelerator(

    /* [in] */ lpmsg lpmsg,

    /* [in] */ const guid __rpc_far *pguidcmdgroup,

    /* [in] */ dword ncmdid) {

        return e_notimpl;

    }

  virtual hresult stdmethodcalltype getoptionkeypath(

    /* [out] */ lpolestr __rpc_far *pchkey,

    /* [in] */ dword dw) {

        return e_notimpl;

    }

  virtual hresult stdmethodcalltype getdroptarget(

    /* [in] */ idroptarget __rpc_far *pdroptarget,

本文关键:一种全新的软件界面设计方法
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top