本文整理汇总了C++中ITypeInfo::ReleaseFuncDesc方法的典型用法代码示例。如果您正苦于以下问题:C++ ITypeInfo::ReleaseFuncDesc方法的具体用法?C++ ITypeInfo::ReleaseFuncDesc怎么用?C++ ITypeInfo::ReleaseFuncDesc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITypeInfo
的用法示例。
在下文中一共展示了ITypeInfo::ReleaseFuncDesc方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetEventNames
HRESULT CJSProxyObj::SetEventNames()
{
ITypeInfo* pInfo;
if (m_pTypeInfo == nullptr)
pInfo = theApp.m_pEventTypeInfo.p;
else
pInfo = m_pTypeInfo.p;
TYPEATTR *pta = nullptr;;
HRESULT hr = pInfo->GetTypeAttr(&pta);
if (FAILED(hr))
return hr;
BSTR bstrName = ::SysAllocString(L"");
FUNCDESC *pfd = nullptr;
unsigned int uiNames = 0;
for (int i = 0; i < pta->cFuncs; i++)
{
hr = pInfo->GetFuncDesc(i, &pfd);
if (FAILED(hr))
continue;
hr = pInfo->GetNames(pfd->memid, &bstrName, 1, &uiNames);
if (SUCCEEDED(hr) && bstrName && SysStringLen(bstrName))
{
m_mapDispId.Add(pfd->memid, bstrName);
ATLTRACE(_T("*********Add function '%s' in Tangram*******\r\n"), OLE2T(bstrName));
}
pInfo->ReleaseFuncDesc(pfd);
pfd = nullptr;
}
pInfo->ReleaseTypeAttr(pta);
return hr;
}
示例2: ITypeCompBind
static PyObject* ITypeCompBind( ITypeComp* pTC, OLECHAR* S, unsigned short w )
{
ITypeInfo* pI;
DESCKIND DK;
BINDPTR BP;
PyObject* ret;
unsigned long hashval = 0;
PY_INTERFACE_PRECALL;
#ifndef MS_WINCE
// appears in the headers for CE, but wont link!?
hashval = LHashValOfNameSys(SYS_WIN32,LOCALE_USER_DEFAULT,S);
#endif
SCODE sc = pTC->Bind(S, hashval,w, &pI, &DK, &BP);
PY_INTERFACE_POSTCALL;
if (FAILED(sc))
return PyCom_BuildPyException(sc);
switch(DK){
case DESCKIND_FUNCDESC:
ret = PyObject_FromFUNCDESC(BP.lpfuncdesc);
pI->ReleaseFuncDesc(BP.lpfuncdesc);
break;
case DESCKIND_VARDESC:
ret = PyObject_FromVARDESC(BP.lpvardesc);
pI->ReleaseVarDesc(BP.lpvardesc);
break;
case DESCKIND_TYPECOMP:
ret = PyCom_PyObjectFromIUnknown(BP.lptcomp, IID_ITypeComp, FALSE);
break;
case DESCKIND_IMPLICITAPPOBJ:
ITypeComp* pTC2;
pI->GetTypeComp(&pTC2);
ret = PyTuple_New(2);
if (ret) {
// NOTE: SET_ITEM consumes the refcounts.
PyTuple_SET_ITEM( ret, 0, PyObject_FromVARDESC(BP.lpvardesc) );
PyTuple_SET_ITEM( ret, 1, ITypeCompBind(pTC2,S,w) );
}
pTC2->Release();
pI->ReleaseVarDesc(BP.lpvardesc);
break;
case DESCKIND_NONE:
default:
Py_INCREF(Py_None);
ret = Py_None;
break;
}
if (pI)
pI->Release();
if (ret == NULL)
return NULL;
PyObject *real_ret = PyTuple_New(2);
if (real_ret==NULL)
return NULL;
// NOTE: SET_ITEM consumes the refcounts.
PyTuple_SET_ITEM(real_ret, 0, PyInt_FromLong(DK) );
PyTuple_SET_ITEM(real_ret, 1, ret );
return real_ret;
}
示例3: ThrowComFail
JNIEXPORT jobject JNICALL Java_org_racob_com_TypeInfo_getFuncDesc
(JNIEnv *env, jobject obj, jint pointer, jint index) {
ITypeInfo *typeInfo = (ITypeInfo *) pointer;
if (!typeInfo) return NULL;
FUNCDESC *funcDesc = NULL;
HRESULT hr = typeInfo->GetFuncDesc(index, &funcDesc);
if (!SUCCEEDED(hr)) {
ThrowComFail(env, "getFuncDesc failed", hr);
return NULL;
}
int paramLength = funcDesc->cParams;
unsigned int nameLength = 0;
BSTR *names = (BSTR *) malloc(sizeof(BSTR) * paramLength + 1);
hr = typeInfo->GetNames(funcDesc->memid, names, paramLength + 1, &nameLength);
if (FAILED(hr)) {
typeInfo->ReleaseFuncDesc(funcDesc);
ThrowComFail(env, "getFuncDesc failed", hr);
return NULL;
}
SysFreeString(names[0]);
jclass paramClass = env->FindClass("org/racob/com/Parameter");
jmethodID paramCons = env->GetMethodID(paramClass, "<init>", "(Ljava/lang/String;ZZZZIZLorg/racob/com/Variant;)V");
jobjectArray parameters = env->NewObjectArray(nameLength - 1, paramClass, 0);
for (int i = 0; i < nameLength - 1; i++) {
jobject parameter = createParameter(env, paramClass, paramCons,
funcDesc->lprgelemdescParam[i], names[i+1]);
env->SetObjectArrayElement(parameters, i, parameter);
env->DeleteLocalRef(parameter);
}
jobject returnValue = createParameter(env, paramClass, paramCons, funcDesc->elemdescFunc, NULL);
jclass autoClass = env->FindClass("org/racob/com/FuncDesc");
jmethodID autoCons = env->GetMethodID(autoClass, "<init>", "(IIII[Lorg/racob/com/Parameter;Lorg/racob/com/Parameter;II)V");
jobject newAuto = env->NewObject(autoClass, autoCons, funcDesc->memid,
index, funcDesc->invkind, funcDesc->wFuncFlags, parameters,
returnValue, funcDesc->cParamsOpt, funcDesc->oVft);
typeInfo->ReleaseFuncDesc(funcDesc);
return newAuto;
}
示例4: DumpComTypes
void DumpComTypes(ITypeLib* pTypeLib)
{
// Dump out the types.
USES_CONVERSION;
pTypeLib->AddRef();
ULONG typeCount = pTypeLib->GetTypeInfoCount();
cout << "\n****** The COM Types ******" << endl;
cout << "There are " << typeCount << " in this type lib" << endl << endl;
for(ULONG typeIndex = 0; typeIndex < typeCount; typeIndex++)
{
ITypeInfo* pInfo = NULL;
TYPEATTR* typeAtt;
CComBSTR temp;
ULONG index = 0;
ULONG numbMembers = 0;
pTypeLib->GetTypeInfo(typeIndex, &pInfo);
pInfo->GetTypeAttr(&typeAtt);
// Based on the kind of COM type, print out some information.
switch(typeAtt->typekind)
{
case TKIND_COCLASS: // type is a coclass.
cout << "(" << typeIndex << ")" << " Coclass with " << typeAtt->cImplTypes << " interface(s). ******" << endl;
temp = typeAtt->guid;
cout << "->CLSID: " << W2A(temp.Copy()) << endl;
pInfo->GetDocumentation(-1, &temp, NULL, NULL, NULL);
cout << "->Name: " << W2A(temp.Copy()) << endl;
break;
case TKIND_DISPATCH: // type is a IDispatch derived interface.
cout << "(" << typeIndex << ")" << " IDispatch based interface with " << typeAtt->cFuncs << " method(s). ******" << endl;
temp = typeAtt->guid;
cout << "->IID: " << W2A(temp.Copy()) << endl;
pInfo->GetDocumentation(-1, &temp, NULL, NULL, NULL);
cout << "->Name: " << W2A(temp.Copy()) << endl;
numbMembers = typeAtt->cFuncs;
for(index = 0; index < numbMembers; index++)
{
FUNCDESC* fx;
pInfo->GetFuncDesc(index, &fx);
pInfo->GetDocumentation(fx->memid, &temp, NULL, NULL, NULL);
cout << " ->" << W2A(temp.Copy()) << " has " << fx->cParams << " params" << endl;
pInfo->ReleaseFuncDesc(fx);
}
break;
case TKIND_INTERFACE: // Type is an IUnknown derived interface.
cout << "(" << typeIndex << ")" << " IUnknown based interface with " << typeAtt->cFuncs << " method(s). ******" << endl;
temp = typeAtt->guid;
cout << "->IID: " << W2A(temp.Copy()) << endl;
pInfo->GetDocumentation(-1, &temp, NULL, NULL, NULL);
cout << "->Name: " << W2A(temp.Copy()) << endl;
numbMembers = typeAtt->cFuncs;
for(index = 0; index < numbMembers; index++)
{
FUNCDESC* fx;
pInfo->GetFuncDesc(index, &fx);
pInfo->GetDocumentation(fx->memid, &temp, NULL, NULL, NULL);
cout << " ->" << W2A(temp.Copy()) << " has " << fx->cParams << " param(s)" << endl;
pInfo->ReleaseFuncDesc(fx);
}
break;
case TKIND_ENUM: // Type is an enum.
cout << "(" << typeIndex << ")" << " Enum with " << typeAtt->cVars << " member(s). ******" << endl;
pInfo->GetDocumentation(-1, &temp, NULL, NULL, NULL);
cout << "->Name: " << W2A(temp.Copy()) << endl;
numbMembers = typeAtt->cVars;
for(index = 0; index < numbMembers; index++)
{
VARDESC* var;
pInfo->GetVarDesc(index, &var);
pInfo->GetDocumentation(var->memid, &temp, NULL, NULL, NULL);
cout << " ->" << W2A(temp.Copy()) << endl;
pInfo->ReleaseVarDesc(var);
}
break;
default:
cout << "Some other type I don't care about..." << endl;
}
cout << endl;
pInfo->ReleaseTypeAttr(typeAtt);
pInfo->Release();
}
pTypeLib->Release();
}
示例5: InitEvent
STDMETHODIMP ESource::InitEvent(IDispatch *SourceDispatch,
OrxScript *ORexxScript,
FILE *LogFile)
{
ITypeInfo *SourceType;
TYPEATTR *TypeAttributes;
BSTR SourceName;
unsigned int NameCount;
int i;
FUNCDESC *FuncDesc;
char DispIDName[29];
PEMAP NewMap;
HRESULT RetCode=S_OK;
int EMCount;
FPRINTF2(LogFile,"created a new Event Source. %p\n",this);
FPRINTF2(DLLlogfile,"created a new Event Source.%p\n",this);
EventType = AddScriptlet;
Source = SourceDispatch; // Mimick the ParseProcedures "THIS" parameter by returning this pointer.
Engine = ORexxScript;
Connected = false;
ConnectionPoint = NULL;
Container = NULL;
logfile = LogFile;
RetCode = GetTypeInfo(&SourceType);
if (SUCCEEDED(RetCode))
{
RetCode = SourceType->GetTypeAttr(&TypeAttributes);
memcpy(&SourceGUID,&TypeAttributes->guid,sizeof(GUID));
EMCount = TypeAttributes->cFuncs;
SourceType->ReleaseTypeAttr(TypeAttributes);
OLECHAR lGUID[50];
StringFromGUID2(SourceGUID,lGUID,sizeof(lGUID));
FPRINTF2(logfile,"The GUID is %S and there are %d functions.\n",lGUID,EMCount);
/* For each entry in the type library, create an entry on the Event Map chain.
* This is a many to one relation. Each of the different Source Disp ID's
* will translate to the same Sink Disp ID. There is only one chunk of code
* being bound to this Event that the Type Library is describing. So every
* Source call must map to the same Sink.
*/
for (i=0; i<EMCount; i++)
{
SourceType->GetFuncDesc(i, &FuncDesc);
// Despite what the documentation says, this returns Max Names, not Max Names - 1.
// The first name is the function name, the remainder if they exist are parameters.
SourceType->GetNames(FuncDesc->memid, &SourceName, 1, &NameCount);
sprintf(DispIDName,"%d",FuncDesc->memid);
// This creates the entry for the function with an invalid DispID to call.
RetCode = AddMap(DispIDName,&NewMap);
if (FAILED(RetCode)) return RetCode;
FPRINTF2(logfile,"ESource::InitEvent - AddScriptlet \"%S\" \n",SourceName);
NewMap->SourceEventName = SourceName;
SourceType->ReleaseFuncDesc(FuncDesc);
}
SourceType->Release();
}
else
{
FPRINTF2(logfile,"Could not obtain TypInfo for this event! HRESULT %08x\n",RetCode);
}
return RetCode;
}