win32ole: method call with &params

C

Chris Atwood

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
 
D

Dave Burt

Chris said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top