//////////////////////////////////////////////////////////////////////////
/// \brief   GetLastError 값에 대한 string 얻기
/// \param
/// \return
/// \warning
/// \section update
//////////////////////////////////////////////////////////////////////////
CString GetFormatMessageString(DWORD dwError)
{
 LPVOID lpMsgBuf;

 /*
 FormatMessage( DWORD dwFlags,
 LPCVOID lpSource,
 DWORD dwMessageId,
 DWORD dwLanguageId,
 LPTSTR lpBuffer,
 DWORD nSize,
 va_list *Arguments )
 */

 FormatMessage(  FORMAT_MESSAGE_ALLOCATE_BUFFER
  | FORMAT_MESSAGE_FROM_SYSTEM
  | FORMAT_MESSAGE_IGNORE_INSERTS
  , NULL
  , dwError
  , MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT)
  , (LPTSTR)&lpMsgBuf
  , 0
  , NULL
  );

 CString str;
 str.Format(_T("%s"), lpMsgBuf);

 LocalFree(lpMsgBuf);
 return str;
}

Posted by 아..몰라 ㅡ.ㅡ+
,