Randy
Joined: 27 Feb 2003 Posts: 3532 Location: OPC Foundation
|
Posted: Wed Nov 30, 2005 2:54 pm Post subject: How COM and OPC assigns HRESULT codes |
|
|
The OPC specifications follow the convention recommended by Microsoft when it comes assigning numeric values to OPC defined errors. Unfortunately, this means that OPC defined error codes can conflict with error codes defined by other applications such as COM+. The text of the recommendation can be found here:
| Quote: | |
For most status codes returned from interface methods. The actual meaning of the error is defined by the interface. That is, two HRESULTs with exactly the same 32-bit value returned from two different interfaces might have different meanings.
|
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/com/html/97e68708-eb62-4481-af03-cf8b80304103.asp
Therefore, all applications processing error codes returned from an OPC interfaces (i.e. by calling FormatMessage) should assume that the error code is an OPC code first. If no matching OPC code is found then the application should look for system defined codes. An application that looks for system defined codes first could incorrectly identify an OPC error as a system error. |
|