Leaked source code of windows server 2003
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.

71 lines
1.5 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1996 - 1997.
  5. //
  6. // File: oleinit.hxx
  7. //
  8. // Contents:
  9. //
  10. // Classes:
  11. //
  12. // Functions:
  13. //
  14. // Coupling:
  15. //
  16. // Notes:
  17. //
  18. // History: 11-11-1996 ericne Created
  19. //
  20. //----------------------------------------------------------------------------
  21. #ifndef _COLEINIT
  22. #define _COLEINIT
  23. //+---------------------------------------------------------------------------
  24. //
  25. // Class: COleInitialize ()
  26. //
  27. // Purpose:
  28. //
  29. // Interface: fIsInitialized -- BOOL which determines whether a call
  30. // to OleUninitialize is necessary
  31. //
  32. // History: 11-11-1996 ericne Created
  33. //
  34. // Notes:
  35. //
  36. //----------------------------------------------------------------------------
  37. class COleInitialize
  38. {
  39. BOOL fIsInitialized;
  40. public:
  41. COleInitialize( )
  42. : fIsInitialized( FALSE )
  43. {
  44. HRESULT hr = OleInitialize( NULL );
  45. if( S_OK == hr || S_FALSE == hr )
  46. {
  47. fIsInitialized = TRUE;
  48. }
  49. else
  50. {
  51. printf( "ERROR : OleInitialize returned 0x%08x\r\n", hr );
  52. exit( -1 );
  53. }
  54. }
  55. ~COleInitialize( )
  56. {
  57. if( fIsInitialized )
  58. OleUninitialize( );
  59. }
  60. };
  61. #endif