CimCreateSafeArray (function)

Syntax

CimSafeArray = CimCreateSafeArray()

Description

Returns an Automation object that can create and manipulate an array that be used with Automation methods and properties that require arrays.

Status

The extension can be used.

Comments

Native arrays created in Basic cannot be passed to Automation methods that require array parameters. Similarly, Automation methods that return arrays, return Automation arrays – not Basic arrays. The CimSafeArray Automation object allows you to manipulate Automation arrays in Basic.

Example

Dim vtx As CimSafeArrayLib.COCimSafeArray

Dim obj As GefObjectModel.GefObject

Dim bdr As GefObjectModel.GefObject

Set vtx = CimCreateSafeArray()

vtx.CreateVector cimVLong, 0, 8

Set obj = CimGetObject()

'Create a red line around the object

vtx.SetVectorElement 0, obj.Left

vtx.SetVectorElement 1, obj.Top

vtx.SetVectorElement 2, obj.Left + obj.Width

vtx.SetVectorElement 3, obj.Top

vtx.SetVectorElement 4, obj.Left + obj.Width

vtx.SetVectorElement 5, obj.Top - obj.Height

vtx.SetVectorElement 6, obj.Left

vtx.SetVectorElement 7, obj.Top - obj.Height

Set bdr = obj.Parent.AddPolyline(vtx, True)

bdr.Line.ForeColor.RGB = &hFF

bdr.Fill.None

CimGetScreen().Refresh False

 

More information

Basic Extensions.