コード例 #1
1
ファイル: hspvar_comobj.cpp プロジェクト: zakki/openhsp
static void get_interfacename( IUnknown *punk, VARIANT *vres )
{
	HRESULT hr;
	IDispatch *pDisp;
	ITypeInfo *pTI;
	BSTR bstr = NULL;
	hr = punk->QueryInterface( IID_IDispatch, (void **)&pDisp );
	if ( SUCCEEDED(hr) && pDisp != NULL ) {
		hr = pDisp->GetTypeInfo( 0, LOCALE_USER_DEFAULT, &pTI );
		if ( SUCCEEDED(hr) && pTI != NULL ) {
			hr = pTI->GetDocumentation( MEMBERID_NIL, &bstr, NULL, NULL, NULL );
			pTI->Release();
		}
		pDisp->Release();
	}
	if ( bstr == NULL ) {
		bstr = SysAllocString( L"" );
	}
	vres->bstrVal = bstr;
	vres->vt = VT_BSTR;
}
コード例 #2
0
ファイル: PyIType.cpp プロジェクト: malrsrch/pywin32
PyObject *PyITypeInfo::GetDocumentation(MEMBERID id)
{
	BSTR name, docstring, helpfile;
	unsigned long helpctx;
	ITypeInfo *pMyTypeInfo = GetI(this);
	if (pMyTypeInfo==NULL) return NULL;

	PY_INTERFACE_PRECALL;
	SCODE sc = pMyTypeInfo->GetDocumentation(id, &name, &docstring, &helpctx, &helpfile);
	PY_INTERFACE_POSTCALL;
	if (FAILED(sc))
		return PyCom_BuildPyException(sc, pMyTypeInfo, IID_ITypeInfo);

	// NOTE - These BSTR's seem not to have a reasonable length.
	// Specifically, DAO3032 leaves crap at the end if we use
	// MakeBSTRToObj.
	PyObject *obName = MakeOLECHARToObj(name);
	PyObject *obDocstring = MakeOLECHARToObj(docstring);
	PyObject *obHelpfile = MakeOLECHARToObj(helpfile);

	PyObject *ret = Py_BuildValue("(OOiO)", obName, obDocstring, helpctx, obHelpfile);

	SysFreeString(name);
	Py_XDECREF(obName);
	SysFreeString(docstring);
	Py_XDECREF(obDocstring);
	SysFreeString(helpfile);
	Py_XDECREF(obHelpfile);

	return ret;
}
コード例 #3
0
ファイル: TypeInfo.cpp プロジェクト: enebo/racob
  JNIEXPORT jobject JNICALL Java_org_racob_com_TypeInfo_getDocumentation
  (JNIEnv *env, jobject obj, jint pointer, jint index) {
   ITypeInfo *typeInfo = (ITypeInfo *) pointer;
   BSTR name;
   BSTR docString;
   unsigned long helpContext;
   BSTR helpFile;
   HRESULT hr = typeInfo->GetDocumentation(index, &name, &docString, &helpContext,
           &helpFile);
   if (!SUCCEEDED(hr)) {
      freeDocumentationStrings(name, docString, helpFile);
      ThrowComFail(env, "getDocumentation failed", hr);
      return NULL;
   }

   jclass autoClass = env->FindClass("org/racob/com/Documentation");
   jmethodID autoCons = env->GetMethodID(autoClass, "<init>",
           "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;I)V");
   jobject newAuto = env->NewObject(autoClass, autoCons, makeString(env, name),
           makeString(env, docString), makeString(env, helpFile), helpContext);

   freeDocumentationStrings(name, docString, helpFile);

   return newAuto;
 }
コード例 #4
0
ファイル: hspvar_comobj.cpp プロジェクト: zakki/openhsp
static void get_coclassname( IUnknown *punk, VARIANT *vres )
{
	HRESULT hr;
	IProvideClassInfo *pPCI;
	ITypeInfo *pTI;
	BSTR bstr = NULL;
	hr = punk->QueryInterface( IID_IProvideClassInfo, (void **)&pPCI );
	if ( SUCCEEDED(hr) && pPCI != NULL ) {
		hr = pPCI->GetClassInfo( &pTI );
		if ( SUCCEEDED(hr) && pTI != NULL ) {
			hr = pTI->GetDocumentation( MEMBERID_NIL, &bstr, NULL, NULL, NULL );
			pTI->Release();
		}
		pPCI->Release();
	}
	if ( bstr == NULL ) {
		bstr = SysAllocString( L"" );
	}
	vres->bstrVal = bstr;
	vres->vt = VT_BSTR;
}
コード例 #5
0
ファイル: CppComTypeReader.cpp プロジェクト: rojac07/COM
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();
}