Skip to content

Add support of array of variants #522

@charphi

Description

@charphi

I need to call a COM method that returns an array of variant.
The var type is 8204 and correspond to VT_ARRAY | VT_VARIANT.

I guess that the code should be added in the class com.sun.jna.platform.win32.Variant.

Here is an example of use in vbs (see GetRows):

On Error Resume Next

Set conn = CreateObject("ADODB.Connection")
conn.Open "Provider=Search.CollatorDSO;Extended Properties='Application=Windows';"

If Err.Number <> 0 Then
  Wscript.Echo "Connection failed: [" &  Err.Number & "] " & Err.Description
  Wscript.quit(1)
End If

Set rs = CreateObject("ADODB.Recordset")
rs.Open "SELECT top 5 System.ItemUrl FROM SYSTEMINDEX WHERE System.FileName like '%readme%'", conn

If Err.Number <> 0 Then
  Wscript.Echo "Query failed: [" &  Err.Number & "] " & Err.Description
  conn.Close
  Wscript.quit(2)
End If

If Not (rs.EOF) Then
  ' >>> GetRows returns a 2-dimensions array
  rows = rs.GetRows
  For i = 0 to uBound(rows)
    Wscript.Echo rows(i,0)
  Next
End If

rs.Close
conn.Close

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions