Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
835 B

  1. // Copyright (c) Microsoft. All rights reserved.
  2. //
  3. // This is unpublished source code of Microsoft.
  4. // The copyright notice above does not evidence any
  5. // actual or intended publication of such source code.
  6. // OneLiner : Implementation of MUsingCom
  7. // DevUnit : wlbstest
  8. // Author : Murtaza Hakim
  9. // include files
  10. #include "MUsingCom.h"
  11. #include <iostream>
  12. using namespace std;
  13. MUsingCom::MUsingCom( DWORD type )
  14. : status( MUsingCom_SUCCESS )
  15. {
  16. HRESULT hr;
  17. // Initialize com.
  18. hr = CoInitializeEx(0, type );
  19. if ( FAILED(hr) )
  20. {
  21. cout << "Failed to initialize COM library" << hr << endl;
  22. status = COM_FAILURE;
  23. }
  24. }
  25. // destructor
  26. MUsingCom::~MUsingCom()
  27. {
  28. CoUninitialize();
  29. }
  30. // getStatus
  31. MUsingCom::MUsingCom_Error
  32. MUsingCom::getStatus()
  33. {
  34. return status;
  35. }