Magpie/Runtime/App.cpp
2021-09-02 19:38:12 +08:00

26 lines
562 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include "pch.h"
#include "App.h"
bool App::Initialize(std::shared_ptr<spdlog::logger> logger) {
_logger = logger;
SPDLOG_LOGGER_INFO(logger, "正在初始化 App");
// 确保只初始化 COM 一次
static bool initalized = false;
if (!initalized) {
HRESULT hr = Windows::Foundation::Initialize(RO_INIT_MULTITHREADED);
if (FAILED(hr)) {
SPDLOG_LOGGER_CRITICAL(logger, fmt::format("初始化 COM 失败\n\tHRESULT{}", hr));
return false;
}
SPDLOG_LOGGER_INFO(logger, "初始化 COM 成功");
initalized = true;
}
return true;
}