IT 취미생활.  
Front Page
Tag | Location | Media | Guestbook | Admin   
 
[VC++] GetLastError 이용한 에러 메시출력 - Win32 API
{
  DWORD eErrorCode  = GetLastError(); // thread 당 1개씩 존재하는 에러코드를 얻는다.
  printf("FAIL : %d ",e);  // 에러번호를 출력

  //에러번호 -> 문자열 변환
  char *szErrorMessage = NULL;

  FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_ALLOCATE_BUFFER,
      0, //문자열을 가진 DLL핸들(0: 시스템으로 부터 얻는다)
      eErrorCode, //에러 번호
      0, //언어
      (char*)&szErrorMessage,0, // 버퍼, 버퍼크기
      0); // va_list형 변수로 얻을때 사용

  printf( "%s ",szErrorMessage );
 
  // FormatMessage() is use the  LocalAlloc() in FormatMessag,
  // you can free buffer for LocalFree....
  LocalFree( szErrorMessage );
 }


BLOG main image
취미생활
 Notice
 Category
분류 전체보기 (191)
매일매일갱생 (83)
서버개발 (1)
임베디드개발 (12)
Programming (80)
Personal Projects (6)
유용한 프로그램 (0)
 TAGS
영어 이메일 알고리즘 warning Brazil M480 퇴사 English Java 음식 C++ 군대 Error Case debugging DVB-T spam mail 티스토리초대 isdbt MP3 Linux 미라지폰 Wince5.0 VC++ english email 출장 벨소리 변경 Dshow DVB 1seg ISDB-T DirectShow It Algorithm Windows Mobile6.0 개발자 C Debug 티스토리 초대장 서태지 project
 Calendar
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
 Recent Entries
 Recent Comments
 Recent Trackbacks
 Archive
 Link Site
zextor
괴짜 프로그래머의 일상사~@@
Gag & Peace, and more..
Kazakhstan Almaty.......
Min-A
Sadgarret
Steve Yoon's log
가슴 뛰는 삶을 살아라
오스틴 파워
GUI sin
melanie parker_Lady
제레미의 TV 2.0 이야기..
 Visitor Statistics
Total :
Today :
Yesterday :
rss