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…
…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.
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.