cominit.cpp 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. ** Command & Conquer Renegade(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. //*****************************************************************************
  19. //
  20. // Copyright (c) 2000 Westwood Studios. All Rights Reserved.
  21. //
  22. // cominit.cpp
  23. //
  24. // Created on 30 Mar 2001 by Tom Spencer-Smith (Westwood/Vegas)
  25. //
  26. // Description:
  27. //
  28. // See h file.
  29. //
  30. //*****************************************************************************
  31. #include "cominit.h"
  32. #include <objbase.h>
  33. //#include "utility.h"
  34. //
  35. // Creating this instance will setup all COM stuff & do cleanup on program exit
  36. //
  37. static cComInit global_com_initializer;
  38. //---------------------------------------------------------------------------
  39. cComInit::cComInit
  40. (
  41. void
  42. )
  43. {
  44. HRESULT hres = ::CoInitialize(NULL);
  45. if (!SUCCEEDED(hres))
  46. {
  47. ::MessageBox(NULL, "Unable to initialize COM.", "Error:", MB_OK | MB_ICONERROR);
  48. ::exit(0);
  49. }
  50. }
  51. //---------------------------------------------------------------------------
  52. cComInit::~cComInit
  53. (
  54. void
  55. )
  56. {
  57. ::CoUninitialize();
  58. }
  59. //---------------------------------------------------------------------------