SAMPLE: SAFEARAY: Use of Safe Arrays in Automation
ID: Q131086
|
The information in this article applies to:
-
Microsoft OLE Libraries for Windows and Win32s, version 2.03
-
Microsoft OLE Libraries, used with:
-
Microsoft Windows NT, versions 3.5, 3.51
-
Microsoft Windows 95
SUMMARY
SAFEARAY is an OLE Automation server application that demonstrates the
use of safe arrays.
The following file is available for download from the Microsoft
Download Center. Click the file name below to download the file:
Safearay.exe
For more information about how to download files from the Microsoft
Download Center, please visit the Download Center at the following Web
address
http://www.microsoft.com/downloads/search.asp
and then click How to use the Microsoft Download Center.
MORE INFORMATION
SAFEARAY implements the following methods (in addition to the standard
application object methods).
SlowSort: Sorts an input safearray of BSTRs and returns the sorted array
and the time required for the sort. The array is passed by reference
because it needs to be modified by the sort. SlowSort uses
SafeArrayGetElement and SafeArrayPutElement to access the array
elements.
FastSort: Has the same functionality as SlowSort but uses
SafeArrayAccessData to get a pointer to the array elements. This allows
array elements to be accessed directly instead of using
SafeArrayGetElement and SafeArrayPutElement. This accounts for the speed
improvement over SlowSort.
Average: Finds the average of an input safe array of integers. The array
is not passed by reference.
GetArray: Creates and returns a safe array of BSTRs.
See the README.TXT included for instructions to compile and run this
sample.
Additional query words:
Keywords : kbfile kbprg kbAutomation kbNTOS350 kbWinOS95 kbGrpCom kbDSupport LeTwoAt
Version : WINDOWS:2.03,95; :
Platform : WINDOWS
Issue type : kbhowto