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 '<dispatch id:37: )
  OLE error code:0 in <Unknown>
    <No Description>
  Invalid number of parameters.
  from (irb): 5: in '_invoke'
  from C:/................../bin/irb:12:in '<main>'

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

Hi

With _invoke, you may set the initial values in the second
argument as same type as specified in the third argument,
and don't include for [retval].
So, please try to write as
a._invoke(dispid, [0,0,0,0],

[VT_I4|VT_BYREF,VT_I4|VT_BYREF,VT_I4|VT_BYREF,VT_I4|VT_BYREF])
.

Cheers

arton

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])

···

--- George Thomas <george.thomas@trianz.com> wrote:

The error in this case is

WIN32OLERuntimeError: (in OLE method '<dispatch
id:37: )
  OLE error code:0 in <Unknown>
    <No Description>
  Invalid number of parameters.
  from (irb): 5: in '_invoke'
  from C:/................../bin/irb:12:in '<main>'

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/\.

--------------------------------------
2010 FIFA World Cup News [Yahoo!Sports/sportsnavi]
http://pr.mail.yahoo.co.jp/southafrica2010/