Handling array arguments.

BasicATLServer1.zip
  1. Open BasicATLServer and add another interface.

    1. Open the project and go to the idl file.
    2. Declare IArrayAccess interface.
    3. Include definition of IArrayAccess into the coclass clause.
    4. Open TheCoClass header file and add the IArrayAccess to the base classes.
    5. Add IArrayAccess to the COM MAP.
    6. Use COM_INTERFACE_ENTRY_IID macro to resolve ambiguity of IDispatch in the class hierarchy.
    7. Add C++ prototypes for the functions of IArrayAccess.
    8. Build the project. It compiles but the linker is missing the implementations.

  2. Implement the IArrayAccess functions.

    Add the implementations:
    TheCoClass.cpp
    Variant.h
    SafeArray.h
    Variant.cpp


  3. Build and test the client application.

    1. In the VBA IDE goto Tools\references and check the server in.
    2. Add the VBA code to a worksheet module.
    3. Test the sum function. Highlight a range. At right click the sum of all numeric values in the range appears to the right of the last cell of the highlighted range.
    4. Test the getArray function. At double click previous results of the right click operation are displayed.

Hosted by www.Geocities.ws

1