#include "stdafx.h"

#include "xtr/ui/ComHelper.h"

namespace xtr::ui {

ComInitializer::ComInitializer() {
  const auto result = ::CoInitializeEx(nullptr, COINIT_MULTITHREADED);
  needClose = result == S_OK;
  if (needClose) {
    assert(SUCCEEDED(result));
  }
}

ComInitializer::~ComInitializer() {
  if (needClose) {
    CoUninitialize();
  }
}

} // namespace xtr::ui
