I am having to use some old legacy code which throws HRESULTS. How do I catch these exceptions? What is the catch parameter for it?
This is a discussion on Catching A HRESULT? within the C++ Programming forums, part of the General Programming Boards category; I am having to use some old legacy code which throws HRESULTS. How do I catch these exceptions? What is ...
I am having to use some old legacy code which throws HRESULTS. How do I catch these exceptions? What is the catch parameter for it?
catch(HRESULT hr)
For information on how to enable C++11 on your compiler, look here.
よく聞くがいい!私は天才だからね! ^_^
You should post the smallest possible compilable example that exhibits the problem, then.
For information on how to enable C++11 on your compiler, look here.
よく聞くがいい!私は天才だからね! ^_^
Are you sure that they are throwing a HRESULT and not an exception like wrapper like _com_error or CAtlException?
If it's using something like this:then it is the kind of thing I use every day at work.Code:HRESULT hr = E_FAIL; _com_issue_error(hr)
You should catch it like this:Code:catch(const _com_error &e)
My homepage
Advice: Take only as directed - If symptoms persist, please see your debugger
Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"
You may be having an issue related to threading or a non-local stack.
Where is the exception being thrown from? Where are you trying to catch it?
Soma