The ATLSafeArray sample shows how to create and maintain SAFEARRAYs using CComSafeArray. It also shows how to pass SAFEARRAYs from a component to script: when the user clicks the buttons on the HTML page, various methods in the control are executed.
| Security Note |
|---|
This sample code is provided to illustrate a concept and should not be used in applications or Web sites, as it may not illustrate the safest coding practices. |
Building and Running the Sample
To build and run this sample
Open the solution file ATLSafeArray.sln.
From the Build menu, click Build Solution.
When the build finishes, open ATLSafeArray.htm in your Web browser.
Fill in the text box and click the appropriate buttons to Add, Change, or Remove an item from the list box.
Classes and Keywords
This sample demonstrates the following classes:
CComSafeArray; CComVariant
This sample demonstrates the following keywords:
CComSafeArray::Add; CComSafeArray::SetAt; CComSafeArray::operator=; CComSafeArray::operator[]; CComSafeArray::GetCount; CComSafeArray::Resize; CComVariant::Detach