[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

win32ole: method call with ¶ms

Chris Atwood

6/16/2006 4:19:00 PM

I'm new to win32ole in ruby and I've run in to a problem I don't know
how to solve.

The COM method I'm trying to call has the definition:
retval = ModelDoc2.SaveAs4 ( Name, Version, Options, &Errors,
&Warnings )

In the Ruby OLE browser this method is:
Class ModelDoc2
GUID : {27526253-6119-4B38-A1F9-2DC877E72334}
PROGID :
DESCRIPTION :

FUNC BOOL SaveAs4
Dispatch ID : 66296
DESCRIPTION : Saves the document under a different name
arg1 - BSTR Name [IN]
arg2 - I4 Version [IN]
arg3 - I4 Options [IN]
arg4 - I4 Errors [IN,OUT]
arg5 - I4 Warnings [IN,OUT]

I've tried 0, integer variable names, nil - the errors look like:
in `method_missing`: SaveAs4 (WIN32OLERuntimeError)
OLE error code 0: in <Unknown>
<No Description>
HRESULT error code: 0x80020005
Type mismatch.

It seems I need to pass in a reference to an integer so that the method
can output an errors through these arguments. I found a few posts
years ago about ByRef call in win32ole not being possible - is that
still the case? or this there a way around this?

Thanks,
Chris

1 Answer

Dave Burt

6/16/2006 10:01:00 PM

0

Chris Atwood wrote:
> I'm new to win32ole in ruby and I've run in to a problem I don't know
> how to solve.
>
> The COM method I'm trying to call has the definition:
> retval = ModelDoc2.SaveAs4 ( Name, Version, Options, &Errors,
> &Warnings )
>
> In the Ruby OLE browser this method is:
> Class ModelDoc2
> GUID : {27526253-6119-4B38-A1F9-2DC877E72334}
> PROGID :
> DESCRIPTION :
>
> FUNC BOOL SaveAs4
> Dispatch ID : 66296
> DESCRIPTION : Saves the document under a different name
> arg1 - BSTR Name [IN]
> arg2 - I4 Version [IN]
> arg3 - I4 Options [IN]
> arg4 - I4 Errors [IN,OUT]
> arg5 - I4 Warnings [IN,OUT]
>
> I've tried 0, integer variable names, nil - the errors look like:
> in `method_missing`: SaveAs4 (WIN32OLERuntimeError)
> OLE error code 0: in <Unknown>
> <No Description>
> HRESULT error code: 0x80020005
> Type mismatch.
>
> It seems I need to pass in a reference to an integer so that the method
> can output an errors through these arguments. I found a few posts
> years ago about ByRef call in win32ole not being possible - is that
> still the case? or this there a way around this?

I'm just taking a punt, but try passing [0].pack("L"), and look for the
return value in WIN32OLE::ARGV.

Cheers,
Dave