Skip to content

armgit / BUI

Public Imported from GitHub
0

Blender's GPU Accelerated UI, Decoupled from it's original codebase. Supports Rust, Python, JS, React, C & C++. Twice as good as GPUI

627 B
Raw Blame
/* SPDX-FileCopyrightText: 2022 Blender Authors
 *
 * SPDX-License-Identifier: GPL-2.0-or-later */

#pragma once

/** \file
 * \ingroup bli
 * \brief COM helper functions for windows
 */

#ifndef _WIN32
#  error "This include is for Windows only!"
#endif

#include "BLI_sys_types.h"

#include <windows.h>

namespace blender {

class CoInitializeWrapper {
  HRESULT _hr;

 public:
  CoInitializeWrapper(DWORD flags)
  {
    _hr = CoInitializeEx(nullptr, flags);
  }
  ~CoInitializeWrapper()
  {
    if (SUCCEEDED(_hr)) {
      CoUninitialize();
    }
  }
  operator HRESULT()
  {
    return _hr;
  }
};

}  // namespace blender