What's the best way of getting the results of GetLastError() after a WinAPI call into a nice char*?
I'm writing a DLL which a java program uses to call the WinAPI in various ways.开发者_如何学C I want to throw proper exceptions back to java but I need a nicely formated WinAPI error not just the int that get's returned from GetLastError(). I'm sure there's a nice way to do it.
Use "FormatMessage"; you can pass in the error code as the 3rd parameter, and even have FormatMessage allocate the space for you.
精彩评论