client.cpp
上传用户:bjlvip
上传日期:2010-02-08
资源大小:744k
文件大小:1k
- // client.cpp
- #define _WIN32_DCOM
- #include <iostream.h>
- #include <stdio.h>
- #include "Componentcomponent.h"
- void main()
- {
- CoInitialize(NULL);
- cout << "1" << endl;
- IPointerTest* pTest;
- HRESULT hr = CoCreateInstance(CLSID_PointerTest, NULL, CLSCTX_INPROC_SERVER, IID_IPointerTest, (void**)&pTest);
- printf(" result %0xn", hr);
- IPointerTest* pReturnedInterfacePointer;
- // For inproc only
- pTest->GetInterfacePointer1((void**)&pReturnedInterfacePointer);
- pReturnedInterfacePointer->Release();
- cout << "3" << endl;
- pTest->GetInterfacePointer2(IID_IPointerTest, (IUnknown**)&pReturnedInterfacePointer);
- pReturnedInterfacePointer->Release();
- cout << "4" << endl;
- pTest->GetInterfacePointer3(&pReturnedInterfacePointer);
- pReturnedInterfacePointer->Release();
- cout << "5" << endl;
- pTest->GetInterfacePointer4(IID_IPointerTest, (void**)&pReturnedInterfacePointer);
- pReturnedInterfacePointer->Release();
- cout << "6" << endl;
- pTest->Release();
- CoUninitialize();
- }