// OuterComponent.cpp : Implementation of COuterComponent #include "stdafx.h" #include "OuterComponent.h" #include "..\InnerComp\InnerComp.h" // COuterComponent STDMETHODIMP COuterComponent::SendStringForModification(BSTR* str) { // CoInitialize(NULL); this (client) thread is already in STA { CComQIPtr pInner; HRESULT hr = pInner.CoCreateInstance(CLSID_InnerComponent); if(pInner != 0) { pInner->ModifyStringAgain(str); } } // CoUninitialize(); CComBSTR s(*str); s += L"\n Hi from OuterComp"; *str = s; return S_OK; }