Similar question was asked before, but i haven't found some answers there.
As i understand, for making custom HRESULT codes i create an .mc
file where i describe the codes, then compile it and get an .h
file. But i can't get it how to prevent possible overlapping with the system ones.
Example:
LanguageNames=(English=0x409:MSG00409)
MessageId = 0x0
Severity = Success
Facility = Application
SymbolicName = CUSTOME_CODE
Language=English
Cusome message
.
produces
#define CUSTOME_CODE 0x00000000L
which is actually the same with S_OK
.
If i return CUSTOME_CODE
from my method, a caller can't distinguish it from S_OK
;
Wiki says HRESULT contains a bit for distinguishing Microsoft / User defined code properties, but i don't understand how to set it. Also MSDN says that the bit is just "reserved".
How do i make code which can't overlap the system ones?