|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hello,
I'm having a problem trying to pass parameters by reference with WIN32OLE::ARGV. What I'm actually trying to do is getting access to OneNote 2007 as described here... http://msdn2.microsoft.com/de-de/lib...84(en-us).aspx ....but using Ruby instead. Here's my little program: ----- require "win32ole" one = WIN32OLE.new("onenote.application") class ON_CONST end WIN32OLE.const_load(one, ON_CONST) a_string = '' one.GetHierarchy(nil,ON_CONST::HsPages,a_string) ----- GetHierarchy should pass the Hierarchy of OneNote pages into "a_string" (I think). However, WIN32OLE::ARGV leaves "a_string" empty: p WIN32OLE::ARGV prompt> [-2147352572, 4, ""] Using invoke won't make a difference: one.invoke("GetHierarchy", nil,ON_CONST::HsPages,a_string) p WIN32OLE::ARGV prompt> [-2147352572, 4, ""] Does anybody have an idea what I'm getting wrong? (I'm using Ruby 1.8.6) Kind regards, Rainer P.S.: Any example for a successful pass by reference is appreciated, even with another Office program like Excel or Word. P.P.S.: I already have read the earlier discussion from Nov. 14 about the same problem. |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
Hello,
Rainer wrote: > Here's my little program: > > ----- > require "win32ole" > one = WIN32OLE.new("onenote.application") > > class ON_CONST > end > WIN32OLE.const_load(one, ON_CONST) > > a_string = '' > > one.GetHierarchy(nil,ON_CONST::HsPages,a_string) I have not used OneNote 2007, so I'm not sure, but could you try to use empty string (="") instead of nil as 1st argument? one.GetHierarchy("",ON_CONST::HsPages,a_string) Regards, Masaki Suketa |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
Masaki Suketa wrote:
> > one.GetHierarchy(nil,ON_CONST::HsPages,a_string) > > one.GetHierarchy("",ON_CONST::HsPages,a_string) > Or try to use WIN32OLE#_invoke method. include WIN32OLE::VARIANT one._invoke(dispid, ["", ON_ONST::HsPages, a_string], [VT_BSTR, VT_I4, VT_BSTR|VT_BYREF]) The dispid should be dispatch id of GetHierarchy method. Regards, Masaki Suketa |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
On 3 Dez., 00:56, Masaki Suketa <masaki.suk...@nifty.ne.jp> wrote:
> Masaki Suketa wrote: > > > > one.GetHierarchy(nil,ON_CONST::HsPages,a_string) > > > > one.GetHierarchy("",ON_CONST::HsPages,a_string) > > > > Or try to use WIN32OLE#_invoke method. > include WIN32OLE::VARIANT > one._invoke(dispid, ["", ON_ONST::HsPages, a_string], > [VT_BSTR, VT_I4, VT_BSTR|VT_BYREF]) > The dispid should be dispatch id of GetHierarchy method. > > Regards, > Masaki Suketa Dear Masaki, thank you very much, that did the trick! Now I'm getting a massive XML string as promised! Kind regards, Rainer |
|
![]() |
| Outils de la discussion | |
|
|