바이후의 프로그래밍과 잡다구리 콜렉션~♥

검색 :
RSS 구독 : 글 / 댓글 / 트랙백 / 글+트랙백

[DEBUG] GetLastError를 이용해 마지막 에러 내용 보이기

// 마지막 에러 메시지를 디버그창에 보여준다.
DWORD CDMFCommonUtil::ShowLastError(void)
{
 LPVOID lpMsgBuf;  
 DWORD err;
 
 err = GetLastError();
 ::FormatMessage(
  FORMAT_MESSAGE_ALLOCATE_BUFFER |
  FORMAT_MESSAGE_FROM_SYSTEM |
  FORMAT_MESSAGE_IGNORE_INSERTS,
  NULL,
  err,
  MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
  (LPTSTR) &lpMsgBuf,
  0,
  NULL
    );
 
 TRACE0(lpMsgBuf);
 //AfxMessageBox((LPTSTR)lpMsgBuf);
 ::LocalFree( lpMsgBuf );
 return err;
}
2008/05/29 09:56 2008/05/29 09:56

맨 위로