Complicated output parameter in WIN32OLE

Discussion in 'Ruby' started by Mitchell Hashimoto, Apr 8, 2010.

  1. 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/.
     
    Mitchell Hashimoto, Apr 8, 2010
    #1
    1. Advertising

  2. Mitchell Hashimoto

    Chuck Remes Guest

    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
     
    Chuck Remes, Apr 8, 2010
    #2
    1. Advertising

  3. 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/.
     
    Mitchell Hashimoto, Apr 8, 2010
    #3
  4. Mitchell Hashimoto

    Chuck Remes Guest

    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
     
    Chuck Remes, Apr 8, 2010
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Marius Vollmer
    Replies:
    6
    Views:
    831
    Jim Lewis
    Dec 10, 2003
  2. Dave Burt
    Replies:
    9
    Views:
    174
  3. Masaki Suketa
    Replies:
    4
    Views:
    392
    Dave Burt
    Mar 27, 2006
  4. Dennis Misener

    Win32OLE output parameter access??

    Dennis Misener, Mar 29, 2006, in forum: Ruby
    Replies:
    5
    Views:
    164
    Dennis Misener
    Mar 29, 2006
  5. zxem
    Replies:
    1
    Views:
    245
Loading...

Share This Page