Sha256: 87b7f0ba9e621d01bc169bac63963fa5ef1505b00f9b48dc7d382c8939db6a7a
Contents?: true
Size: 1.72 KB
Versions: 13
Compression:
Stored size: 1.72 KB
Contents
Index: ext/win32ole/win32ole.c IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- ext/win32ole/win32ole.c (revision ) +++ ext/win32ole/win32ole.c (revision ) @@ -9073,6 +9073,46 @@ st_free_table(enc2cp_table); } + + +/* + * WIN32OLE.connect_unknown( pUnknown ) --> aWIN32OLE + * ---- + * Returns running OLE Automation object or WIN32OLE object from a +IUnknown pointer + * the IUnknown pointer is passed in as a FIXNUM + */ +static VALUE +fole_s_connect_unknown(VALUE self, VALUE iUnknown) +{ + HRESULT hr; + IDispatch *pDispatch; + IUnknown *pUnknown; + + /* initialize to use OLE */ + ole_initialize(); + + //cast from int to IUnknown* + pUnknown = (IUnknown*)FIX2INT(iUnknown); + + hr = pUnknown->lpVtbl->QueryInterface(pUnknown, &IID_IDispatch, + (void **)&pDispatch); + if(FAILED(hr)) { + OLE_RELEASE(pUnknown); + ole_raise(hr, eWIN32OLERuntimeError, + "Failed to connect to WIN32OLE server `%d'", + FIX2INT(iUnknown)); + } + + OLE_RELEASE(pUnknown); + + return create_win32ole_object(self, pDispatch, 0,0); +} + + + + + void Init_win32ole() { @@ -9105,6 +9145,8 @@ rb_define_method(cWIN32OLE, "initialize", fole_initialize, -1); rb_define_singleton_method(cWIN32OLE, "connect", fole_s_connect, -1); + rb_define_singleton_method(cWIN32OLE, "connect_unknown", fole_s_connect_unknown, 1); + rb_define_singleton_method(cWIN32OLE, "const_load", fole_s_const_load, -1); rb_define_singleton_method(cWIN32OLE, "ole_free", fole_s_free, 1);
Version data entries
13 entries across 13 versions & 1 rubygems