/////////////////////////////////////////////////////////////// // ATLclient.cpp - client of ISum interface // // ver 1.0 // // // // demonstrate creation of simple ATL-based, in-process // // component. This client uses _com_ptr and _com_error // // classes. // // // // Language: Visual C++, ver 6.0 // // Platform: Micron Dual Pentium Pro 200, Win NT 4.0 // // Application: Demo: CSE791 - Distributed Objects // // Author: Jim Fawcett, CST 2-187, Syracuse Univ. // // (315) 443-3948, fawcett@ecs.syr.edu // /////////////////////////////////////////////////////////////// #include "stdafx.h" #include #import "ATLexe.tlb" no_namespace using namespace std; /////////////////////////////////////////////////////////////// // uncomment the EXTERN_C and add ATLexe_i.c to project // // if you want to use the ISumPtr pSum(CLSID_Sum) constr'n // // // // EXTERN_C const CLSID CLSID_Sum; // /////////////////////////////////////////////////////////////// void main() { cout << "\n Testing ATLexe Out-of-proc Component " << "\n ======================================\n"; try { CoInitializeEx(NULL,COINIT_APARTMENTTHREADED); ISumPtr pSum(_T("ATLexe.Sum.1")); // ISumPtr pSum(CLSID_Sum); int x=3, y=5, result; pSum->Sum(x,y,&result); cout << "\n result of adding " << x << " and " << y << " is " << result; cout << "\n\n"; } catch(_com_error e) { cout << e.ErrorMessage() << endl; } CoUninitialize(); }