/////////////////////////////////////////////////////////////// // 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 "A3.h" using namespace std; int main() { cout << "\n Midterm A, Question #3 - out array of shorts " << "\n ===============================================\n" << endl; // Initialize COM Library CoInitialize(NULL) ; wstring prefix = L" Client: \t\t"; try { CComQIPtr pIArray; pIArray.CoCreateInstance(CLSID_IArray); int size; short *pArray = 0; cout << "\n address of array before calling function = " << pArray << "\n\n "; if(pIArray) { HRESULT hr; hr = pIArray->getArray(&size,&pArray); // type of &pArray is short** if(!SUCCEEDED(hr)) throw "call to getArray(...) failed"; for(int i=0; i