本文整理汇总了C++中ITypeInfo::GetContainingTypeLib方法的典型用法代码示例。如果您正苦于以下问题:C++ ITypeInfo::GetContainingTypeLib方法的具体用法?C++ ITypeInfo::GetContainingTypeLib怎么用?C++ ITypeInfo::GetContainingTypeLib使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITypeInfo
的用法示例。
在下文中一共展示了ITypeInfo::GetContainingTypeLib方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ThrowComFail
JNIEXPORT jobject JNICALL Java_org_racob_com_TypeInfo_getContainingTypeLib
(JNIEnv *env, jobject obj, jint pointer) {
ITypeInfo *typeInfo = (ITypeInfo *) pointer;
ITypeLib* typeLib = NULL;
unsigned int index = 0;
HRESULT hr = typeInfo->GetContainingTypeLib(&typeLib, &index);
if (!SUCCEEDED(hr)) {
ThrowComFail(env, "GetContainingTypeLib failed", hr);
return NULL;
}
int typeCount = typeLib->GetTypeInfoCount();
if (typeCount == E_NOTIMPL) {
ThrowComFail(env, "GetContainingTypeLib failed to get count", hr);
return NULL;
}
TLIBATTR *libAttr = NULL;
hr = typeLib->GetLibAttr(&libAttr);
if (!SUCCEEDED(hr)) {
ThrowComFail(env, "Automation.loadTypeLibEx failed", hr);
return NULL;
}
jstring guid = makeGUIDString(env, libAttr->guid);
jclass autoClass = env->FindClass("org/racob/com/TypeLib");
jmethodID autoCons = env->GetMethodID(autoClass, "<init>", "(IILjava/lang/String;IIII)V");
jobject newAuto = env->NewObject(autoClass, autoCons, (jint) typeLib, index,
guid, typeCount, libAttr->wLibFlags, libAttr->wMajorVerNum,
libAttr->wMinorVerNum);
typeLib->ReleaseTLibAttr(libAttr);
return newAuto;
}
示例2: GetUserDefaultLCID
CJSProxyObj::CJSProxyObj(CJSExtender* _pJSExtender, IDispatch *pDisp, const GUID iid, CString strPrefix) :
m_dwCookie(0xFEFEFEFE), m_pDisp(pDisp), m_EventIID(iid)
{
m_pEventObj = nullptr;
ITypeInfo* pTypeInfo = nullptr;
m_pJSExtender = _pJSExtender;
if (theApp.m_pEventProxy)
{
m_pEventObj = theApp.m_pEventProxy;
theApp.m_pEventProxy = nullptr;
}
else
{
pDisp->GetTypeInfo(0, GetUserDefaultLCID(), &pTypeInfo);
if (pTypeInfo)
{
CComPtr<ITypeLib> pTypeLib;
UINT nIndex = 0;
pTypeInfo->GetContainingTypeLib(&pTypeLib, &nIndex);
pTypeLib->GetTypeInfoOfGuid(iid, &m_pTypeInfo);
pTypeInfo->Release();
}
}
CString strName = strPrefix;
auto it = m_pJSExtender->m_mapCloudJSObject.find(strName);
if (it != m_pJSExtender->m_mapCloudJSObject.end())
{
int nSize = m_pJSExtender->m_mapCloudJSObject.size();
CString s = _T("");
s.Format(_T("%s_%d_"), strName, nSize);
strName = s;
}
m_bstrPrefix = CComBSTR(strName);
SetEventNames();
m_pJSExtender->m_mapCloudJSObject[strName] = this;
HRESULT hr = AtlAdvise(m_pDisp, this, m_EventIID, &m_dwCookie);
}
示例3: CHECKPARAM
ITypeInfo *tCOMUtil::GetCoClassTypeInfo(IDispatch* pdisp, CLSID clsid)
{
CHECKPARAM(pdisp);
ITypeInfo* typeinfo = NULL;
ITypeLib* typelib = NULL;
HRESULT hr = S_OK;
{
unsigned int typeinfocount = 0;
hr = pdisp->GetTypeInfoCount(&typeinfocount);
if(FAILED(hr) || typeinfocount == 0)
return NULL;
}
hr = pdisp->GetTypeInfo(0, 0, &typeinfo);
if(FAILED(hr))
return NULL;
{
unsigned int dumb_index = -1;
hr = typeinfo->GetContainingTypeLib(&typelib, &dumb_index);
COM_RELEASE(typeinfo);
}
if(FAILED(hr))
return NULL;
ITypeInfo* coclasstypeinfo = tCOMUtil::GetCoClassTypeInfo(typelib, clsid);
typelib->Release();
return coclasstypeinfo;
}
示例4: PyCom_BuildPyException
PyObject *PyITypeInfo::GetContainingTypeLib()
{
// BUGBUG??
// Note that since we do not check to see if there is already a Python
// object corresponding to the returned typelib, we could theoretically
// end up with multiple Python objects pointing to the same OLE objects
// Maybe we should to keep a global mapping of C/C++/OLE objects by
// their memory address onto Python objects (by their memory address).
ITypeInfo *pMyTypeInfo = GetI(this);
if (pMyTypeInfo==NULL) return NULL;
ITypeLib *ptlib;
unsigned index;
PY_INTERFACE_PRECALL;
SCODE sc = pMyTypeInfo->GetContainingTypeLib(&ptlib, &index);
PY_INTERFACE_POSTCALL;
if (FAILED(sc))
return PyCom_BuildPyException(sc, pMyTypeInfo, IID_ITypeInfo);
PyObject *ret = PyTuple_New(2);
PyTuple_SetItem(ret, 0, PyCom_PyObjectFromIUnknown(ptlib, IID_ITypeLib));
PyTuple_SetItem(ret, 1, PyInt_FromLong(index));
return ret;
}
示例5:
ITypeInfo *tCOMUtil::GetDispatchTypeInfo(IDispatch* pdisp)
{
ITypeInfo* typeinfo = NULL;
HRESULT hr = pdisp->GetTypeInfo(0, LOCALE_SYSTEM_DEFAULT, &typeinfo);
if(FAILED(hr))
return NULL;
TYPEATTR *ptypeattr = NULL;
typeinfo->GetTypeAttr(&ptypeattr);
TYPEKIND typekind = ptypeattr->typekind;
if(typekind == TKIND_DISPATCH)
{
typeinfo->ReleaseTypeAttr(ptypeattr);
return typeinfo;
}
// tries to find another description of the same
// interface in the typelib with TKIND_DISPATCH
ITypeLib *ptypelib = NULL;
unsigned int dumb = 0;
IID iid = ptypeattr->guid;
hr = typeinfo->GetContainingTypeLib(&ptypelib, &dumb);
typeinfo->ReleaseTypeAttr(ptypeattr);
// if there's no containing type lib, we have to
// trust this one is the right type info
if(FAILED(hr))
return typeinfo;
// obtem a typeinfo do iid fornecido
// caso haja uma implementacao dispinterface,
// esta' e' que sera' retornada (segundo
// documentacao do ActiveX
ITypeInfo* typeinfo_guid = NULL;
hr = ptypelib->GetTypeInfoOfGuid(iid, &typeinfo_guid);
if(FAILED(hr))
{
ptypelib->Release();
return typeinfo;
}
// verifica se e' dispinterface
TYPEATTR *ptypeattr_iface = NULL;
hr = typeinfo_guid->GetTypeAttr(&ptypeattr_iface);
TYPEKIND typekind_iface = ptypeattr_iface->typekind;
typeinfo_guid->ReleaseTypeAttr(ptypeattr_iface);
if(typekind_iface == TKIND_DISPATCH)
{
// releases original type information
COM_RELEASE(typeinfo);
return typeinfo_guid;
}
else
{
COM_RELEASE(typeinfo_guid);
// returns original type info
return typeinfo;
}
}
示例6: qax_generateDocumentation
//.........这里部分代码省略.........
if (hasParams)
detail += QLatin1String("\tQVariantList params = ...\n");
detail += QLatin1String("\t");
QByteArray functionToCall = "dynamicCall";
if (returntype == "IDispatch*" || returntype == "IUnknown*") {
functionToCall = "querySubObject";
returntype = "QAxObject *";
}
if (returntype != "void")
detail += QLatin1String(returntype.constData()) + QLatin1String(" result = ");
detail += QLatin1String("object->") + QLatin1String(functionToCall.constData()) +
QLatin1String("(\"" + name + prototype + '\"');
if (hasParams)
detail += QLatin1String(", params");
detail += QLatin1Char(')');
if (returntype != "void" && returntype != "QAxObject *" && returntype != "QVariant")
detail += QLatin1Char('.') + QLatin1String(toType(returntype));
detail += QLatin1String(";</pre>\n");
} else {
detail += QLatin1String("<p>This function has parameters of unsupported types and cannot be called directly.");
}
methodDetails << detail;
defArgCount = 0;
}
stream << "</ul>" << endl;
}
int signalCount = mo->methodCount();
if (signalCount) {
ITypeLib *typeLib = 0;
if (typeInfo) {
UINT index = 0;
typeInfo->GetContainingTypeLib(&typeLib, &index);
typeInfo->Release();
}
typeInfo = 0;
stream << "<h2>Signals:</h2>" << endl;
stream << "<ul>" << endl;
for (int isignal = mo->methodOffset(); isignal < signalCount; ++isignal) {
const QMetaMethod signal(mo->method(isignal));
if (signal.methodType() != QMetaMethod::Signal)
continue;
QByteArray prototype = namedPrototype(signal.parameterTypes(), signal.parameterNames());
QByteArray signature = signal.methodSignature();
QByteArray name = signature.left(signature.indexOf('('));
stream << "<li>void <a href=\"#" << name << "\"><b>" << name << "</b></a>" << prototype << ";</li>" << endl;
QString detail = QLatin1String("<h3><a name=") + QLatin1String(name.constData()) + QLatin1String("></a>void ") +
QLatin1String(name.constData()) + QLatin1Char(' ') +
QLatin1String(prototype.constData()) + QLatin1String("<tt> [signal]</tt></h3>\n");
if (typeLib) {
interCount = 0;
do {
if (typeInfo)
typeInfo->Release();
typeInfo = 0;
typeLib->GetTypeInfo(++interCount, &typeInfo);
QString typeLibDocu = docuFromName(typeInfo, QString::fromLatin1(name.constData()));
if (!typeLibDocu.isEmpty()) {
detail += typeLibDocu;
break;
}