TypeInfo::AddressOfMember

来源:互联网 发布:淘宝导航好做吗 编辑:程序博客网 时间:2024/05/11 01:41

参考:http://msdn.microsoft.com/en-us/library/windows/desktop/ms221544%28v=vs.85%29.aspx

下面是汉字版的:

检索静态函数或变量(如那些在 DLL 中定义的静态函数或变量)的地址。

void AddressOfMember(   int memid,   INVOKEKIND invKind,   [   Out] IntPtr* ppv);

参数

memid
要检索的 static (Shared in Visual Basic) 成员地址的成员 ID。
invKind
指定该成员是否为属性,如果是,还指定是哪种属性。
ppv
成功返回时,为对 static (Shared in Visual Basic) 成员的一个引用。

备注

有关 ITypeInfo::AddressOfMember 的其他信息,请参见 MSDN Library。

要求

平台: Windows 98, Windows NT 4.0, Windows ME, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 系列

------下面是我的一段程序片段---------------------------------------------------------

LPTYPEINFO lpRefTypeInfo;LPTYPEATTR lpRefTypeAttr;pDisp->GetTypeInfo(0, 0, &lpRefTypeInfo);HRESULT hr = lpRefTypeInfo->GetTypeAttr(&lpRefTypeAttr);for (int Index = 0; Index < lpRefTypeAttr->cFuncs; Index++ ){LPFUNCDESC lpFuncDesc;ULONG FunAddr;hr = lpRefTypeInfo->GetFuncDesc(Index, &lpFuncDesc);if ( hr != S_OK ) {continue;}void** p = NULL;hr = lpRefTypeInfo->AddressOfMember(lpFuncDesc->memid, lpFuncDesc->invkind, p);//hr = E_NOTIMPL,可能因为这个函数不是静态成员函数或变量吧}

参考:http://www.vckbase.com/index.php/wv/1238


原创粉丝点击