我发现有的接口用BindToObject返回时空的指针,但是用BindToStorage每次都能正确返回指针?

解决方案 »

  1.   

    后者会尝试激活Moniker 前者不会
      

  2.   

    我可否这么理解,BindToObject会复制出一个独立的拷贝出来,而调用BindToStorage会使用他本身的东西?
      

  3.   

    ls的理解基本正确查看一下msdn中的说明
     
    IMoniker::BindToStorage  
    Retrieves an interface pointer to the storage that contains the object identified by the moniker. Unlike the IMoniker::BindToObject method, this method does not activate the object identified by the moniker.BindToStorage函数并不会创建一个别名对应的对象。而BindToObject函数会根据需要创建一个对象处理