[前][次][番号順一覧][スレッド一覧]

ruby-changes:1834

From: ko1@a...
Date: 1 Sep 2007 08:19:30 +0900
Subject: [ruby-changes:1834] suke - Ruby:r13325 (ruby_1_8): * ext/win32ole/win32ole.c: add WIN32OLE#ole_activex_initialize.

suke	2007-09-01 08:19:16 +0900 (Sat, 01 Sep 2007)

  New Revision: 13325

  Modified files:
    branches/ruby_1_8/ChangeLog
    branches/ruby_1_8/ext/win32ole/win32ole.c
    branches/ruby_1_8/version.h

  Log:
    * ext/win32ole/win32ole.c: add WIN32OLE#ole_activex_initialize.


  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/ChangeLog?r1=13325&r2=13324
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/ext/win32ole/win32ole.c?r1=13325&r2=13324
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/version.h?r1=13325&r2=13324

Index: ruby_1_8/ext/win32ole/win32ole.c
===================================================================
--- ruby_1_8/ext/win32ole/win32ole.c	(revision 13324)
+++ ruby_1_8/ext/win32ole/win32ole.c	(revision 13325)
@@ -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*);
@@ -3262,6 +3262,54 @@
 }
 
 /*
+ *  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 @@
     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());
Index: ruby_1_8/ChangeLog
===================================================================
--- ruby_1_8/ChangeLog	(revision 13324)
+++ ruby_1_8/ChangeLog	(revision 13325)
@@ -1,3 +1,7 @@
+Sat Sep  1 08:13:36 2007  Masaki Suketa  <masaki.suketa@n...>
+
+	* ext/win32ole/win32ole.c: add WIN32OLE#ole_activex_initialize.
+
 Thu Aug 30 13:13:13 2007  Nobuyoshi Nakada  <nobu@r...>
 
 	* lib/mkmf.rb (try_const, have_const): check for a const is defined.
Index: ruby_1_8/version.h
===================================================================
--- ruby_1_8/version.h	(revision 13324)
+++ ruby_1_8/version.h	(revision 13325)
@@ -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[];

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml

[前][次][番号順一覧][スレッド一覧]