37 DWORD errorMessageID = ::GetLastError();
38 LPSTR messageBuffer =
nullptr;
39 size_t size = FormatMessageA(
40 FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM
41 | FORMAT_MESSAGE_IGNORE_INSERTS,
42 NULL, errorMessageID, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
43 (LPSTR) & messageBuffer, 0, NULL);
44 std::string message(messageBuffer, size);
45 LocalFree(messageBuffer);
std::string GetLastErrorString()