/////////////////////////////////////////////////////////////////// // ATLhost.cpp - ATL OutProc component that hosts two InProcs // // - ATL InProc string echoer // // - Raw C++ InProc_Ex1, slightly modified // // // // Language: C++, COM/IDL // // Platform: Dell Dimension 9200, WinXP, SP2 // // Application: Demonstration for CSE775 - Distrib. Objs // // Author: Jim Fawcett, Syracuse Univ, CST 2-187 // // (315) 443-3948, jfawcett@twcny.rr.com // // created: 01 Apr 07 // /////////////////////////////////////////////////////////////////// #include "stdafx.h" #include "ATLhost.h" #include "../ATLechoInProc/ATLechoInProc.h" #include "../Inproc_Ex1/cmpnt.h" #include //----< invoke single method of ATLechoInProc >---------------------- STDMETHODIMP CATLhost::invokeEcho(BSTR* pStr) { HRESULT hr; CComQIPtr pIEcho; pIEcho.CoCreateInstance(CLSID_Echo); if(pIEcho) { hr = pIEcho->echo(pStr); if(!SUCCEEDED(hr)) { CComBSTR temp(*pStr); temp = L""; return E_FAIL; } } return S_OK; } //----< invoke string input method on Inproc_Ex1 >------------------- STDMETHODIMP CATLhost::invokeFx(BSTR str) { HRESULT hr; CComQIPtr pIString; pIString.CoCreateInstance(CLSID_inproc1_Ex1); if(pIString) { ::MessageBox(NULL,str,L"ATLhost::invokeFx",MB_OK); hr = pIString->Fx(str); if(!SUCCEEDED(hr)) { return E_FAIL; } } return S_OK; } //----< invoke string output method on Inproc_Ex1 >------------------ STDMETHODIMP CATLhost::invokeFy(BSTR* pStr) { HRESULT hr; CComQIPtr pIString; pIString.CoCreateInstance(CLSID_inproc1_Ex1); if(pIString) { hr = pIString->Fy(pStr); if(!SUCCEEDED(hr)) { return E_FAIL; } return S_OK; } return E_FAIL; }