mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/win32ole/win32ole.c: add WIN32OLE#ole_activex_initialize,
a little bit supporting ActiveX control. [ruby-talk:241188] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12082 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ae2c8b45d2
commit
d50f882cf0
2 changed files with 55 additions and 1 deletions
|
@ -1,3 +1,8 @@
|
|||
Fri Mar 16 22:19:24 2007 Masaki Suketa <masaki.suketa@nifty.ne.jp>
|
||||
|
||||
* ext/win32ole/win32ole.c: add WIN32OLE#ole_activex_initialize,
|
||||
a little bit supporting ActiveX control. [ruby-talk:241188]
|
||||
|
||||
Fri Mar 16 22:16:58 2007 Minero Aoki <aamine@loveruby.net>
|
||||
|
||||
* lib/net/http.rb: merge Ruby-SSPI patch contributed by Justin
|
||||
|
|
|
@ -116,7 +116,7 @@
|
|||
|
||||
#define WC2VSTR(x) ole_wc2vstr((x), TRUE)
|
||||
|
||||
#define WIN32OLE_VERSION "1.0.1"
|
||||
#define WIN32OLE_VERSION "1.0.2"
|
||||
|
||||
typedef HRESULT (STDAPICALLTYPE FNCOCREATEINSTANCEEX)
|
||||
(REFCLSID, IUnknown*, DWORD, COSERVERINFO*, DWORD, MULTI_QI*);
|
||||
|
@ -363,6 +363,7 @@ static VALUE ole_usertype2val(ITypeInfo *pTypeInfo, TYPEDESC *pTypeDesc, VALUE t
|
|||
static VALUE ole_ptrtype2val(ITypeInfo *pTypeInfo, TYPEDESC *pTypeDesc, VALUE typedetails);
|
||||
static VALUE ole_typedesc2val(ITypeInfo *pTypeInfo, TYPEDESC *pTypeDesc, VALUE typedetails);
|
||||
static VALUE fole_method_help(VALUE self, VALUE cmdname);
|
||||
static VALUE fole_activex_initialize(VALUE self);
|
||||
static VALUE foletype_s_ole_classes(VALUE self, VALUE typelib);
|
||||
static VALUE foletype_s_typelibs(VALUE self);
|
||||
static VALUE foletype_s_progids(VALUE self);
|
||||
|
@ -4259,6 +4260,53 @@ fole_method_help(VALUE self, VALUE cmdname)
|
|||
return obj;
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* WIN32OLE#ole_activex_initialize() -> Qnil
|
||||
*
|
||||
* Initialize WIN32OLE object(ActiveX Control) by calling
|
||||
* IPersistMemory::InitNew.
|
||||
*
|
||||
* Before calling OLE method, some kind of the ActiveX controls
|
||||
* created with MFC should be initialized by calling
|
||||
* IPersistXXX::InitNew.
|
||||
*
|
||||
* If and only if you recieved the exception "HRESULT error code:
|
||||
* 0x8000ffff catastrophic failure", try this method before
|
||||
* invoking any ole_method.
|
||||
*
|
||||
* obj = WIN32OLE.new("ProgID_or_GUID_of_ActiveX_Control")
|
||||
* obj.ole_activex_initialize
|
||||
* obj.method(...)
|
||||
*
|
||||
*/
|
||||
static VALUE
|
||||
fole_activex_initialize(VALUE self)
|
||||
{
|
||||
struct oledata *pole;
|
||||
IPersistMemory *pPersistMemory;
|
||||
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
OLEData_Get_Struct(self, pole);
|
||||
|
||||
hr = pole->pDispatch->lpVtbl->QueryInterface(pole->pDispatch, &IID_IPersistMemory,
|
||||
(void **)&pPersistMemory);
|
||||
if (SUCCEEDED(hr)) {
|
||||
hr = pPersistMemory->lpVtbl->InitNew(pPersistMemory);
|
||||
OLE_RELEASE(pPersistMemory);
|
||||
if (SUCCEEDED(hr)) {
|
||||
return Qnil;
|
||||
}
|
||||
}
|
||||
|
||||
if (FAILED(hr)) {
|
||||
ole_raise(hr, eWIN32OLERuntimeError, "fail to initialize ActiveX control");
|
||||
}
|
||||
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* WIN32OLE_TYPE.ole_classes(typelib)
|
||||
|
@ -7959,6 +8007,7 @@ Init_win32ole()
|
|||
|
||||
rb_define_method(cWIN32OLE, "ole_method", fole_method_help, 1);
|
||||
rb_define_alias(cWIN32OLE, "ole_method_help", "ole_method");
|
||||
rb_define_method(cWIN32OLE, "ole_activex_initialize", fole_activex_initialize, 0);
|
||||
rb_define_method(cWIN32OLE, "ole_type", fole_type, 0);
|
||||
rb_define_alias(cWIN32OLE, "ole_obj_help", "ole_type");
|
||||
rb_define_method(cWIN32OLE, "ole_typelib", fole_typelib, 0);
|
||||
|
|
Loading…
Add table
Reference in a new issue