HRESULT hr = S_OK; //initialization`
if (int i == 5)
{
hr = 1; //Is it correct usage?
}
if (hr == 1)
cout<<"The value of i is 5";
As I always heard HRESULT output in strings like E_TIMEOUT etc. whether it's correct to use a number like I've used.
An HRESULT of
0orS_OKis the standard "success" code. Whereas1is S_FALSE, which means, "success, but I didn't exactly do you what you asked because it was probably already done".Standard pattern is something closer to this: