Hi,
winrt::hresult_error
catch (winrt::hresult_error const& ex)
{
winrt::hresult hr = ex.code (); // HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND).
winrt::hstring message = ex.message (); // The system cannot find the file specified.
throw winrt::hresult_error (hr, message);
}
As Darran Rowe said, there are HasKey and
GetNamedString(String, String)
Gets the String value with the specified name, or the provided default value if no such named value is found.
So throwing an exception is not needed.
Best regards,
Minxin Yu
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.