///////////////////////////////////////////////////////////////////// // client.cpp - Client for Second ATL Demo, Spring 2008 // // // // Jim Fawcett, CST 4-187, (315)443-3948, jfawcett@twcny.rr.com // ///////////////////////////////////////////////////////////////////// #include "stdafx.h" #include "../ATL_OutProcST/ATL_OutProcST_i.h" #include int _tmain(int argc, _TCHAR* argv[]) { std::cout << "\n Second ATL Demonstration, Spring 2008"; std::cout << "\n =======================================\n"; ::CoInitialize(NULL); // create single-threaded apartment CComQIPtr pComp; // construct smart interface pointer pComp.CoCreateInstance(CLSID_Comp); // create instance of COM object, Comp HRESULT hr; if(pComp) { hr = pComp->Start(0); // invoke putString through IDemo COM interface if(!SUCCEEDED(hr)) // test for success { std::cout << "\n call to IComp::Start(count) failed\n\n"; return 1; } else { std::cout << "\n call to IComp::Start(count) succeeded"; } hr = pComp->Stop(); // invoke getString through IDemo COM interface if(!SUCCEEDED(hr)) // test for success { std::cout << "\n call to IComp::Stop() failed\n\n"; return 1; } else { std::cout << "\n call to IComp::Stop() succeeded\n\n"; } } std::cout << "\n\n"; return 0; }