///////////////////////////////////////////////////////////////// // client.cpp - Uses CComQIPtr and CComBST wrapper classes // // to Simplify Client Code. // // // // Note: Client type code is used here and in OuterComp as // // well, since OuterComp is a client of InnerComp // // // // Jim Fawcett, CSE775 - Distributed Objects, Spring 2003 // ///////////////////////////////////////////////////////////////// #include "stdafx.h" #include #include #include #include "..\OuterComp\OuterComp.h" using namespace std; template string title(const string& t) { string underline(t.length()+2,ch); return (string("\n ") + t + string("\n ") + underline); } int _tmain(int argc, _TCHAR* argv[]) { cout << title<'='>("Client Calling a Component that Calls Another"); CoInitialize(NULL); { CComQIPtr pOuter; HRESULT hr = pOuter.CoCreateInstance(CLSID_OuterComponent); if(pOuter != 0) { CComBSTR str(OLESTR("\n Hi There from client!")); pOuter->SendStringForModification(&str); wcout << str.Detach() << L"\n\n"; } } CoUninitialize(); return 0; }