yohhoyの日記

技術的メモをしていきたい日記

2021-08-06から1日間の記事一覧

HRESULT型からのエラーメッセージ取得

WindowsOS環境のHRESULT型エラーコードからエラーメッセージ文字列へのお手軽変換。Microsoft Visual C++(MSVC)限定。 #include <windows.h> #include <system_error> std::string get_message(HRESULT hr) { return std::system_category().message(hr); } // GetLastError()戻り値な</system_error></windows.h>…