aboutsummaryrefslogtreecommitdiffstats
path: root/ext/win32ole/win32ole_type.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/win32ole/win32ole_type.c')
-rw-r--r--ext/win32ole/win32ole_type.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/ext/win32ole/win32ole_type.c b/ext/win32ole/win32ole_type.c
index f358536707..00db09e191 100644
--- a/ext/win32ole/win32ole_type.c
+++ b/ext/win32ole/win32ole_type.c
@@ -66,6 +66,30 @@ ITypeInfo *itypeinfo(VALUE self)
return ptype->pTypeInfo;
}
+VALUE
+ole_type_from_itypeinfo(ITypeInfo *pTypeInfo)
+{
+ ITypeLib *pTypeLib;
+ VALUE type = Qnil;
+ HRESULT hr;
+ unsigned int index;
+ BSTR bstr;
+
+ hr = pTypeInfo->lpVtbl->GetContainingTypeLib( pTypeInfo, &pTypeLib, &index );
+ if(FAILED(hr)) {
+ return Qnil;
+ }
+ hr = pTypeLib->lpVtbl->GetDocumentation( pTypeLib, index,
+ &bstr, NULL, NULL, NULL);
+ OLE_RELEASE(pTypeLib);
+ if (FAILED(hr)) {
+ return Qnil;
+ }
+ type = create_win32ole_type(pTypeInfo, WC2VSTR(bstr));
+ return type;
+}
+
+
/*
* call-seq:
* WIN32OLE_TYPE.ole_classes(typelib)