/////////////////////////////////////////////////////////////// // client.cpp - client of IArray interface // // ver 1.0 // // // // demonstrate creation of simple ATL-based, in-process // // component. This client uses CComQIPtr and IArray // // classes. // // // // Language: Visual C++, ver 6.0, SP 5.0 // // Platform: Dell Dimension 8100, Win2000, SP2 // // Application: Demo: CSE791 - Distributed Objects // // Author: Jim Fawcett, CST 2-187, Syracuse Univ. // // (315) 443-3948, jfawcett@twcny.rr.com // /////////////////////////////////////////////////////////////// #include #include #include #include #include "B4.h" using namespace std; int main() { cout << "\n Midterm Exam B, Question #4 - in/out array of doubles " << "\n with reallocation of memory in server, " << "\n and using fixed size array " << "\n =======================================================\n" << endl; // Initialize COM Library CoInitialize(NULL) ; wstring prefix = L" Client: \t\t"; try { CComQIPtr pIArray; pIArray.CoCreateInstance(CLSID_Array); int size = 5; double *pDouble = (double*)CoTaskMemAlloc(size*sizeof(double)); int i; for(i=0; isetArray(&size,&pDouble); if(!SUCCEEDED(hr)) throw "call to setArray(...) failed"; cout << "\n size = " << size << ":"; for(i=0; ialtSetArray(size,pDouble); if(!SUCCEEDED(hr)) throw "call to setArray(...) failed"; cout << "\n size = " << size << ":"; for(i=0; i