[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

"Parameter not optional" error using WIN32OLE

Dino

1/5/2005 10:10:00 PM

Perhaps someone has run into this problem before me and can offer a solution.

I am attempting to use an OLE automation server through Ruby. I am calling a function on an automation object, and that function, according to the documentation, can accept a "NULL reference" instead of an object of the desired type. For my application, the NULL value is the correct one. So I am making this call:

notification.Wait(nil, 10.0, nil, false, result)

By the way, the interface I am using was generated by olegen.rb; props to Masaki Suketa for this very useful utility.

Anyway, I have also tried this with a more direct call that looks like this (the comments are copied out from my code):

notification.Wait({
"destinationPropObj" => nil, # data reference; pass nil if you don't want the data
"timeoutInSeconds" => 10.0, # timeout in seconds; pass negative for infinite timeout
"sequenceContextObj" => nil, # sequence context, used to improve blocking behavior for the sequence calling this function (nil if you are not calling from a sequence execution)
"processMsgs" => false, # process Windows messages while waiting? Use true when calling from a sequence, false otherwise
"waitRes" => result # result of the Wait call
}
)

These are only two out of many ways to make this OLE method call in WIN32OLE; I have tried a few others as well.

The problem is that 'nil' is never accepted by WIN32OLE. I always get the following error when trying to pass 'nil' for any argument:

OLE error code:0 in <Unknown>
<No Description>
HRESULT error code:0x8002000f
Parameter not optional. from <my ruby file>

Now, I'm pretty sure at this point that the WIN32OLE library isn't even the entity creating this error, but rather the OLE functionality itself.

At any rate, I am hoping someone might have run into this problem before and be able to help me out. I investigated it extensively over the past few days and just can't find the solution myself.

Thanks for any and all help,
--Dino



--------------= Posted using GrabIt =----------------
------= Binary Usenet downloading made easy =---------
-= Get GrabIt for free from http://www.s... =-

1 Answer

Nicholas Van Weerdenburg

1/9/2005 4:20:00 AM

0

Have you tried directly using win32ole instead of the generated
wrapper? What of using 0 instead of nil? Or just leaving it out when
using the named parameters?


On Thu, 6 Jan 2005 07:11:31 +0900, Dino <dino@notmyrealaddress.com> wrote:
> Perhaps someone has run into this problem before me and can offer a solution.
>
> I am attempting to use an OLE automation server through Ruby. I am calling a function on an automation object, and that function, according to the documentation, can accept a "NULL reference" instead of an object of the desired type. For my application, the NULL value is the correct one. So I am making this call:
>
> notification.Wait(nil, 10.0, nil, false, result)
>
> By the way, the interface I am using was generated by olegen.rb; props to Masaki Suketa for this very useful utility.
>
> Anyway, I have also tried this with a more direct call that looks like this (the comments are copied out from my code):
>
> notification.Wait({
> "destinationPropObj" => nil, # data reference; pass nil if you don't want the data
> "timeoutInSeconds" => 10.0, # timeout in seconds; pass negative for infinite timeout
> "sequenceContextObj" => nil, # sequence context, used to improve blocking behavior for the sequence calling this function (nil if you are not calling from a sequence execution)
> "processMsgs" => false, # process Windows messages while waiting? Use true when calling from a sequence, false otherwise
> "waitRes" => result # result of the Wait call
> }
> )
>
> These are only two out of many ways to make this OLE method call in WIN32OLE; I have tried a few others as well.
>
> The problem is that 'nil' is never accepted by WIN32OLE. I always get the following error when trying to pass 'nil' for any argument:
>
> OLE error code:0 in <Unknown>
> <No Description>
> HRESULT error code:0x8002000f
> Parameter not optional. from <my ruby file>
>
> Now, I'm pretty sure at this point that the WIN32OLE library isn't even the entity creating this error, but rather the OLE functionality itself.
>
> At any rate, I am hoping someone might have run into this problem before and be able to help me out. I investigated it extensively over the past few days and just can't find the solution myself.
>
> Thanks for any and all help,
> --Dino
>
> --------------= Posted using GrabIt =----------------
> ------= Binary Usenet downloading made easy =---------
> -= Get GrabIt for free from http://www.s... =-
>
>


--
Nicholas Van Weerdenburg