forked from MicrosoftEdge/WebView2Samples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCheckFailure.cpp
More file actions
32 lines (28 loc) · 950 Bytes
/
CheckFailure.cpp
File metadata and controls
32 lines (28 loc) · 950 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Copyright (C) Microsoft Corporation. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "stdafx.h"
#include <iomanip>
#include <sstream>
// Notify the user of a failure with a message box.
void ShowFailure(HRESULT hr, const std::wstring& message)
{
std::wstringstream formattedMessage;
formattedMessage << message << ": 0x" << std::hex << std::setw(8) << hr;
MessageBox(nullptr, formattedMessage.str().c_str(), nullptr, MB_OK);
}
// If something failed, show the error code and fail fast.
void CheckFailure(HRESULT hr, const std::wstring& message)
{
if (FAILED(hr))
{
ShowFailure(hr, message);
FAIL_FAST();
}
}
void ExperimentalFeatureNotAvailable()
{
MessageBox(nullptr,
L"This experimental feature is not available in the browser version currently being used.",
L"Feature Not Available", MB_OK);
}