summaryrefslogtreecommitdiff
path: root/ext/win32ole/win32ole_type.c
diff options
context:
space:
mode:
authorsuke <suke@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-08-12 14:21:22 +0000
committersuke <suke@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-08-12 14:21:22 +0000
commitaeb8791dab0accdf4847fe9d35bea1e1907803dc (patch)
treec2a0319e7241276509cd2c07b9d96338df65e76f /ext/win32ole/win32ole_type.c
parent7bf7bb84d3f9390f787d3ba594893f904dc47dc1 (diff)
* ext/win32ole/win32ole.c: refactoring. move some methods
into win32ole_type.c / win32ole_method.c * ext/win32ole/win32ole.h: ditto. * ext/win32ole/win32ole_method.c: ditto. * ext/win32ole/win32ole_method.h: ditto. * ext/win32ole/win32ole_type.h: ditto. * ext/win32ole/win32ole_type.h: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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 f358536..00db09e 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)