Definition of SUCCEEDED(): #define SUCCEEDED(hr) (((HRESULT)(hr)) >= 0)
Background: When an Ok button is clicked on a dialog, I need to return an HRESULT
value hr
such that SUCCEEDED(hr)
is true. If Cancel button is clicked, I need to return a negative value. I could have used bools, but that would break the existing pattern (usually the hr values come from depths of system dlls). So, I know I can return S_OK
on Ok, but what do I return on Cancel? I could just return (HRESULT)-1;
, but there must be a better way - some HRESULT literal constant which has negative value and represents a generic failure. S_FALSE
is not it, for it's value is defined as 1L
.
Please help me find the right constant.