One, the wrong handling mechanism
1.1, in the execution of each function, there will be a special queue.
1.2, in these special queues, will maintain some things.
1.3, these queues are in memory, and memory is stored in a number of values.
1.4, these values are the values that we use GetLastError to obtain,
Second, GetLastError function:
2.1, this function is to get the last error.
2.2, so we have to call this function the first time to get the required error.
2.3. We can use the SetLastError function to create an error code for our own function.
2.4, this error code can be windows to us, or we can create it ourselves.
2.5, so that when we need to get errors, timely call GetLastError this function to get the error we want to get.
Three, FormatMessage function:
3.1. This function is often used in conjunction with the GetLastError function.
3.2, the error code is the corresponding string, the meaning of these strings is to indicate the cause of the error.
3.3, and the existence of these strings are to be allocated to space.
3.4. This function allocates memory for itself.
Windows error handling mechanism