At a very old job (circa Visual Studio 6!) I spent a few years using COM and the ATL to add scripting support to an application. This is some of my old info on doing so.
COM Code Snippets
- ESG Labs COM Utilities - These are a few routines to help you deal with SAFEARRAYs. The crown of the whole thing is SafeArrayChangeType, which follows in the footsteps of ::VariantChangeType.