com 名字对象(1)IBindCtx

转载 2012年03月30日 14:55:25

一.IBindCtx

Provides access to a bind context, which is an object that stores information about a particular moniker binding operation.

How to create

IBindCtx* bindCtx=NULL;
CreateBindCtx(0,&bindCtx);

二.object active status

1.RegisterObjectBound

Registers an object with the bind context to ensure that the object remains active until the bind context is released.

IBindCtx* bindCtx=NULL;
CreateBindCtx(0,&bindCtx);

HRESULT hr;
IUnknown* pUnk = NULL;
hr = CoCreateInstance(CLSID_DuckDoer, NULL, CLSCTX_LOCAL_SERVER, IID_IUnknown, (void**)&pUnk);
bindCtx->RegisterObjectBound(pUnk);
//still alive
pUnk->Release();
//real release
pUnk->Release();

2.RevokeObjectBound

Removes the object from the bind context, undoing a previous call to RegisterObjectBound.

bindCtx->RegisterObjectBound(pUnk);
bindCtx->RevokeObjectBound(pUnk);
//release
pUnk->Release();
//pUnk->AddRef()
bindCtx->RegisterObjectBound(pUnk);
//still release
pUnk->Release();
//real release==pUnk->Release();
bindCtx->RevokeObjectBound(pUnk);

3.ReleaseBoundObjects

Releases all pointers to all objects that were previously registered by calls toRegisterObjectBound.

4.ObjectParam

  1. RegisterObjectParam    Associates an object with a string key in the bind context's string-keyed table of pointers.
  2. GetObjectParam Retrieves an interface pointer to the object associated with the specified key in the bind context's string-keyed table of pointers
  3. RevokeObjectParam Removes the specified key and its associated pointer from the bind context's string-keyed table of objects
  4. EnumObjectParam  Retrieves a pointer to an interface that can be used to enumerate the keys of the bind context's string-keyed table of pointers
     
bindCtx->RegisterObjectParam(OLESTR("testKey"),pUnk);
IUnknown* pUnk2 = NULL;
bindCtx->GetObjectParam(OLESTR("testKey"),&pUnk2);

5.Options

  1. SetBindOptions Sets new values for the binding parameters stored in the bind context.
  2. GetBindOptions

6.com memory

reference:http://www.vckbase.com/document/viewdoc/?id=1493

相关文章推荐

COM原理及应用----命名和绑定技术

1、COM对象的创建方法        客户程序可以通过CoCreateInstance函数创建COM,在创建之前必须知道对象的一些基本情况,比如对象的CLSID或者对象的ProgID。     ...

com 名字对象(2)创建名字对象(IMoniker)

1.文件名字对象 IUnknown* pUnk = NULL; IMoniker* moniker2=NULL; CreateFileMoniker(OLESTR("E:\\test.xlsx"...

临界区,互斥,信号量

临界区(criticalSection) 又称阻塞,它能够使一段代码只由一个线程来执行,其它线程被挡在这段代码之外,直到第一个线程执行完代码。临界区的使用主要涉及如下API函数: init...

com 名字对象(3)使用IMoniker

一.名字对象比较 Hash和IsEqual方法 IMoniker* moniker2=NULL; CreateFileMoniker(OLESTR("F:\\test.xlsx"),&monik...

在数据库连接名跟密码还有数据库名字也正确的时候报错com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Access denied fo

56385 [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1] WARN  com.mchange.v2.resourc...

sc1星际彩色名字修改器.

  • 2009-01-04 08:59
  • 384KB
  • 下载

COM学习--1.COM对象标识

com学习之GUID

java如何在文件中读取一个字符串并创建以这个字符为名字的类的对象

我们一般用properties或者XML文件作为资源存储的文件,现在主要介绍一下对properties的操作 1.我们在src文件下新建一个名称为config的包 2.在config下新建一个...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:深度学习:神经网络中的前向传播和反向传播算法推导
举报原因:
原因补充:

(最多只允许输入30个字)