1
0
Fork 0
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.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@13325 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
suke 2007-08-31 23:19:16 +00:00
parent 9eb692cbe2
commit 1e0687444c
3 changed files with 58 additions and 5 deletions

View file

@ -1,3 +1,7 @@
Sat Sep 1 08:13:36 2007 Masaki Suketa <masaki.suketa@nifty.ne.jp>
* ext/win32ole/win32ole.c: add WIN32OLE#ole_activex_initialize.
Thu Aug 30 13:13:13 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/mkmf.rb (try_const, have_const): check for a const is defined.

View file

@ -79,7 +79,7 @@
#define WC2VSTR(x) ole_wc2vstr((x), TRUE)
#define WIN32OLE_VERSION "0.7.2"
#define WIN32OLE_VERSION "0.7.3"
typedef HRESULT (STDAPICALLTYPE FNCOCREATEINSTANCEEX)
(REFCLSID, IUnknown*, DWORD, COSERVERINFO*, DWORD, MULTI_QI*);
@ -3261,6 +3261,54 @@ fole_method_help( self, 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(self)
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, eWIN32OLE_RUNTIME_ERROR, "fail to initialize ActiveX control");
}
return Qnil;
}
/*
* call-seq:
* WIN32OLE_TYPE.ole_classes(typelib)
@ -6162,6 +6210,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_obj_help", fole_obj_help, 0);
rb_define_method(cWIN32OLE, "ole_activex_initialize", fole_activex_initialize, 0);
rb_define_const(cWIN32OLE, "VERSION", rb_str_new2(WIN32OLE_VERSION));
rb_define_const(cWIN32OLE, "ARGV", rb_ary_new());

View file

@ -1,15 +1,15 @@
#define RUBY_VERSION "1.8.6"
#define RUBY_RELEASE_DATE "2007-08-30"
#define RUBY_RELEASE_DATE "2007-09-01"
#define RUBY_VERSION_CODE 186
#define RUBY_RELEASE_CODE 20070830
#define RUBY_RELEASE_CODE 20070901
#define RUBY_PATCHLEVEL 5000
#define RUBY_VERSION_MAJOR 1
#define RUBY_VERSION_MINOR 8
#define RUBY_VERSION_TEENY 6
#define RUBY_RELEASE_YEAR 2007
#define RUBY_RELEASE_MONTH 8
#define RUBY_RELEASE_DAY 30
#define RUBY_RELEASE_MONTH 9
#define RUBY_RELEASE_DAY 1
#ifdef RUBY_EXTERN
RUBY_EXTERN const char ruby_version[];