There is no such method built into Windows.
The #define identifiers are specific to C and C++ languages and are not used on e.g., C#. Another thing to note is that there can be multiple different #define's for the same error code depending on API used, such as ERROR_INVALID_HANDLE (Win32) and WSA_INVALID_HANDLE (Winsock).