SAMPLE: SAFEARAY: Use of Safe Arrays in Automation

Article translations Article translations
Article ID: 131086 - View products that this article applies to.
This article was previously published under Q131086
Expand all | Collapse all

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:
Safearay.exe
For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base:
119591 How to Obtain Microsoft Support Files from Online Services
Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help to prevent any unauthorized changes to the file.

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.

Properties

Article ID: 131086 - Last Review: August 9, 2004 - Revision: 3.2
APPLIES TO
  • Microsoft OLE 2.03
  • Microsoft OLE 4.0, when used with:
    • Microsoft Windows NT 4.0
    • Microsoft Windows NT 3.51 Service Pack 5
    • Microsoft Windows 95
Keywords: 
kbautomation kbfile kbhowto kbprogramming KB131086

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com