From: George Thomas Date: 2010-06-17T15:24:09+09:00 Subject: WIN332Ole , pass by reference Hi, I am trying to call a method in an ATL (C++ based) dll created by myself through WIN32OLE of Ruby The signature of the method in the idl file is something as follows [id(37), helpstring("method GetCustomArea")] HRESULT GetCustomArea([out] LONG* UpperLeft_XCord, [out] LONG* UpperLeft_YCord, [out] LONG* Width, [out] LONG* Height, [out,retval] VARIANT_BOOL* ReturnVal); In Ruby I have tried something as follows.. require 'win32ole' a = WIN32OLE.new("IDof the component") c = a.GetCustomArea(nil,nil,nil,nil) Further querying the value as(for the first out paramter) WIN32OLE::ARGV[0] does not give me a valid result. I have also tried something as follows.. require 'win32ole' a = WIN32OLE.new("IDof the component") include WIN32OLE::VARIANT dispid = a.ole_method('GetCustomArea').dispid a._invoke(dispid, [nil,nil,nil,nil,nil], [VT_I4|VT_BYREF, VT_I4|VT_BYREF,VT_I4|VT_BYREF,VT_I4|VT_BYREF,VT_BOOL|VT_BYREF]) The error in this case is WIN32OLERuntimeError: (in OLE method ' Invalid number of parameters. from (irb): 5: in '_invoke' from C:/................../bin/irb:12:in '
' Can some one point me in the right direction? I have several other methods in my component. All others are working fine. However , they do not have an [out] parameter. Regards, George -- Posted via http://www.ruby-forum.com/.