Notify the user of a failure with a message box.
| 8 | #include <sstream> |
| 9 | // Notify the user of a failure with a message box. |
| 10 | void ShowFailure(HRESULT hr, const std::wstring& message) |
| 11 | { |
| 12 | std::wstringstream formattedMessage; |
| 13 | formattedMessage << message << ": 0x" << std::hex << std::setw(8) << hr << " (" |
| 14 | << winrt::hresult_error(hr).message().c_str() << ")"; |
| 15 | MessageBox(nullptr, formattedMessage.str().c_str(), nullptr, MB_OK); |
| 16 | } |
| 17 | |
| 18 | // If something failed, show the error code and fail fast. |
| 19 | void CheckFailure(HRESULT hr, const std::wstring& message) |
no outgoing calls
no test coverage detected