/
githubmirror
/
PowerToys
Обзор
Документация
Войти
/
githubmirror
/
PowerToys
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
tools/MonitorReportTool/ErrorMessage.h
26 строк
563 B
Seraphima Zykova
[FancyZones][Tool]Monitor id tool (#18589)
13 июн 2022, 17:37
Не верифицирован
13 июн 2022, 17:37
b5531a1
Код
Авторство
О чём код?
#pragma once #include <optional> #include <string> #include <system_error> #include <Windows.h> inline std::optional<std::wstring> get_last_error_message(const DWORD dw) { std::optional<std::wstring> message; try { const auto msg = std::system_category().message(dw); message.emplace(begin(msg), end(msg)); } catch (...) { } return message; } inline std::wstring get_last_error_or_default(const DWORD dw) { auto message = get_last_error_message(dw); return message.has_value() ? message.value() : L""; }