COM requires that arrays be passed via a special data type known as a SafeArray. You can create and destroy SafeArrays by calling special COM functions to do so, and all elements within a SafeArray must be valid automation-compatible types. The Delphi compiler has built-in knowledge of COM SafeArrays and automatically calls the COM API to create, copy, and destroy SafeArrays.
In the Type Library Editor, a SafeArray must specify the type of its elements. For example, the following line from the text page declares a method with a parameter that is a SafeArray with an element type of Integer:
procedure HighLightLines(Lines: SafeArray of Integer);
HRESULT _stdcall HighlightLines(SAFEARRAY(long) Lines);
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
|
What do you think about this topic? Send feedback!
|