From: Robert Dober Date: 2006-04-07T22:42:20+09:00 Subject: Re: win32ole with COM method taking two out refs ------=_Part_18910_9990778.1144417337115 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 4/7/06, Adam Gardiner wrote: > > Hi, > > I've got a challenge with a COM API that has a method with the > signature: > > OpenApplication arg0, arg1, arg2, arg3, arg4 > where > arg0, arg1, arg2 are String IN paramters (VT_BSTR) > arg3, arg4 are Variant OUT parameters (VT_BYREF|VT_VARIANT) > > Arg3 and Arg4 are both objects returned by OpenApplication - in > particular, arg3 is a HsxServer object for getting (mostly useless) info > about the server, and arg4 is a HsvSession object needed for any useful > work. > > I know I need to retrieve the values of arg3 and arg4 after the call to > OpenApplication using WIN32OLE::ARGV - the problem I have is: What do I > pass as placeholders for arg3 and arg4 so that the call will succeed, > and win32ole will know the types on return? > > I've tried passing nil, which leads to a Type mismatch error. > I've tried passing Object.new, which allows the method to succeed and > returns WIN32OLE objects in ARGV[3] and ARGV[4]. However, these objects > have no associated type library information, so I then receive > "undefined method" errors if I try to call any methods on them. > > In VB, the example code defines variables for arg3 and arg4 that are of > types defined in the type library (HsxServer and HsvSession), i.e. > > Dim session as HsvSession > Dim server as HsxServer > > Is there any way to achieve the same thing in Ruby with win32ole? > > Many thanks, > > Adam WIN32OLE::VARIANT springs into mind, but I have no idea ;). RDoc can be trusted though sometimes. Cheers Robert -- > Posted via http://www.ruby-forum.com/. > > -- Deux choses sont infinies : l'univers et la b=EAtise humaine ; en ce qui concerne l'univers, je n'en ai pas acquis la certitude absolue. - Albert Einstein ------=_Part_18910_9990778.1144417337115--