client.cpp
上传用户:bjlvip
上传日期:2010-02-08
资源大小:744k
文件大小:1k
源码类别:

Windows编程

开发平台:

Visual C++

  1. // client.cpp
  2. #define _WIN32_DCOM
  3. #include <iostream.h>
  4. #include <stdio.h>
  5. #include "Componentcomponent.h"
  6. void main()
  7. {
  8. CoInitialize(NULL);
  9. cout << "1" << endl;
  10. IPointerTest* pTest;
  11. HRESULT hr = CoCreateInstance(CLSID_PointerTest, NULL, CLSCTX_INPROC_SERVER, IID_IPointerTest, (void**)&pTest);
  12. printf(" result  %0xn", hr);
  13. IPointerTest* pReturnedInterfacePointer;
  14. //  For inproc only
  15. pTest->GetInterfacePointer1((void**)&pReturnedInterfacePointer);
  16. pReturnedInterfacePointer->Release();
  17. cout << "3" << endl;
  18. pTest->GetInterfacePointer2(IID_IPointerTest, (IUnknown**)&pReturnedInterfacePointer);
  19. pReturnedInterfacePointer->Release();
  20. cout << "4" << endl;
  21. pTest->GetInterfacePointer3(&pReturnedInterfacePointer);
  22. pReturnedInterfacePointer->Release();
  23. cout << "5" << endl;
  24. pTest->GetInterfacePointer4(IID_IPointerTest, (void**)&pReturnedInterfacePointer);
  25. pReturnedInterfacePointer->Release();
  26. cout << "6" << endl;
  27. pTest->Release();
  28. CoUninitialize();
  29. }