probably very stupid question, but I got stuck on this one :(
I am working with MFCOM (COM interface for Citrix) and one of
properties requires Array as input type...
So I tried simple code, [Array]$Schedules = @(), however to my
surprise System.Array is only base object (never realized that
before).
# [array]$Schedules = @()
# $Schedules.GetType()
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True True Object[]
System.Array
If I try to assign this value to COM, it will return error message
stating that input type is not supported.
I cannot use [System.Array]$Schedules or New-Object (no
constructor)...
Any idea???
Thanks,
Martin
I'm writing COM objects of my own in C++, mainly for use with VBS but I
occasionally also reference them from PS. This is the interface of a method"
Attrib" which sets attributes on files. The attribut-changes must be provided
as an array of BSTRs '+r', '-r', '+h', '-h' ...
void Attrib (
BSTR bstrPath // Single target file path
SAFEARRAY** ppavArgs // Array of attribute strings
)
$mycomref.Attrib( 'c:\temp\test.txt', [ref]@( '+r', '+h', '+s' ) )
... sets the file to "RHS" from PS. I'm not sure if this exactly matches
your scenario, but basically PS arrays may directly be used as COM array
parameters this way.
--
Gerd