///////////////////////////////////////////////////////////////// // client.cpp - Uses CComQIPtr to access component that // // accepts and returns arrays of BSTRs // // // // Jim Fawcett, CSE775 - Distributed Objects, Spring 2003 // ///////////////////////////////////////////////////////////////// //#include "..\stdafx.h" #include #include #include #include "ExamOneQ4.h" using namespace std; template string title(const string& t) { string underline(t.length()+2,ch); return (string("\n ") + t + string("\n ") + underline); } int main() { cout << title<'='>("Client Calling Strings Component"); CoInitialize(NULL); { CComQIPtr pComp; HRESULT hr = pComp.CoCreateInstance(CLSID_Strings); if(pComp != 0) { BSTR strs[3]; strs[0] = SysAllocString(L"Hi there from client"); strs[1] = SysAllocString(L"Hi there again"); strs[2] = SysAllocString(L"Hi there one last time"); pComp->putStringArray(3,strs); int count = 5; BSTR* returnStrs; pComp->getStringArray(&count,&returnStrs); cout << "\n count = " << count; for(int i=0; i