Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Complicated output parameter in WIN32OLE

Reply
Thread Tools

Complicated output parameter in WIN32OLE

 
 
Mitchell Hashimoto
Guest
Posts: n/a
 
      04-08-2010
Hello,

I have a somewhat "complicated" output parameter I need to get via
WIN32OLE and I'm having trouble getting it correct. The method signature
is as follows:

void GetDescription (out VirtualSystemDescriptionType[] aTypes, out
wstring[] aRefs, out wstring[] aOvfValues, out wstring[] aVBoxValues,
out wstring[] aExtraConfigValues)

I'm able to get basic string output parameters fine, but as soon as I
hit this method, I was stumped. How am I supposed to query this method
via the 'win32ole' library. My initial attempts were failures:

object.GetDescription(0, 0, 0, 0, 0) # Errors type mismatch
object.GetDescription([], [], [], [], []) # Errors type mismatch

I'm fairly certain I'll have to use object._invoke directly here but I'm
not sure what types to put into the types array. I have the win32ole.c
file open and I'm looking at the various types which are defined but I'm
not sure which to try.

Some guidance would be greatly appreciated. How would I call this
function?

Thank you,
Mitchell Hashimoto
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
 
Chuck Remes
Guest
Posts: n/a
 
      04-08-2010
On Apr 7, 2010, at 8:05 PM, Mitchell Hashimoto wrote:

> Hello,
>
> I have a somewhat "complicated" output parameter I need to get via
> WIN32OLE and I'm having trouble getting it correct. The method signature
> is as follows:
>
> void GetDescription (out VirtualSystemDescriptionType[] aTypes, out
> wstring[] aRefs, out wstring[] aOvfValues, out wstring[] aVBoxValues,
> out wstring[] aExtraConfigValues)
>
> I'm able to get basic string output parameters fine, but as soon as I
> hit this method, I was stumped. How am I supposed to query this method
> via the 'win32ole' library. My initial attempts were failures:
>
> object.GetDescription(0, 0, 0, 0, 0) # Errors type mismatch
> object.GetDescription([], [], [], [], []) # Errors type mismatch
>
> I'm fairly certain I'll have to use object._invoke directly here but I'm
> not sure what types to put into the types array. I have the win32ole.c
> file open and I'm looking at the various types which are defined but I'm
> not sure which to try.


I'm not sure what to do here either. Have you tried retrieving the WIN32OLE_METHOD and then looping through each param and asking its #ole_type?

Check out WIN32OLE_PARAM.ole_type for the general idea.

cr



 
Reply With Quote
 
 
 
 
Mitchell Hashimoto
Guest
Posts: n/a
 
      04-08-2010
Chuck Remes wrote:
> I'm not sure what to do here either. Have you tried retrieving the
> WIN32OLE_METHOD and then looping through each param and asking its
> #ole_type?
>
> Check out WIN32OLE_PARAM.ole_type for the general idea.


Chuck,

Thanks for the response. I looped through each to print out the ole_type
and got the following:

VirtualSystemDescription,VirtualSystemDescription
BSTR,BSTR
BSTR,BSTR
BSTR,BSTR

I'm not sure why there are two for each? Besides that, do these types
mean something useful for the refs (for arrays)?

Mitchell

--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
Chuck Remes
Guest
Posts: n/a
 
      04-08-2010
On Apr 7, 2010, at 11:33 PM, Mitchell Hashimoto wrote:

> Chuck Remes wrote:
>> I'm not sure what to do here either. Have you tried retrieving the
>> WIN32OLE_METHOD and then looping through each param and asking its
>> #ole_type?
>>
>> Check out WIN32OLE_PARAM.ole_type for the general idea.

>
> Chuck,
>
> Thanks for the response. I looped through each to print out the ole_type
> and got the following:
>
> VirtualSystemDescription,VirtualSystemDescription
> BSTR,BSTR
> BSTR,BSTR
> BSTR,BSTR
>
> I'm not sure why there are two for each? Besides that, do these types
> mean something useful for the refs (for arrays)?


I don't really know how to deal with the VirtualSystemDescription but at least we know the BSTR maps to VT_BSTR in WIN32OLE::VARIANT. That's a good start.

So for BSTR use WIN32OLE::VARIANT::BSTR and for VirtualSystemDescription try WIN32OLE::VARIANT::VT_VARIANT. See what happens when you invoke the method with that argument list.

cr


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
WIN32OLE - failed to create WIN32OLE zxem Ruby 1 12-19-2007 07:01 PM
Win32OLE output parameter access?? Dennis Misener Ruby 5 03-29-2006 02:45 PM
WIN32OLE#[] and WIN32OLE#[]= method in Ruby 1.9 (or later) Masaki Suketa Ruby 4 03-27-2006 11:17 AM
Win32OLE: Output parameters, Dispatch IDs Dave Burt Ruby 9 12-10-2005 05:32 AM
Declaring ports with a complicated array type Marius Vollmer VHDL 6 12-10-2003 07:48 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57