태그 : 디버그

불필요한 기본 디버그 메시지 제거 방법

기본적으로 윈도우간 주고받는 메시지가 디버깅 출력창에 다음과 같이 표시된다.

SENDING command id 0xE100 to CWinApp target.
SENDING command id 0xE101 to CWinApp target.
SENDING command id 0xE103 to CIExplorerDoc target.
No handler for command ID 0xE123, disabling it.
No handler for command ID 0xE122, disabling it.
No handler for command ID 0xE125, disabling it.
SENDING command id 0xE140 to CWinApp target.
SENDING command id 0xE100 to CWinApp target.
SENDING command id 0xE101 to CWinApp target.
SENDING command id 0xE103 to CIExplorerDoc target.
No handler for command ID 0xE123, disabling it.
No handler for command ID 0xE122, disabling it.
No handler for command ID 0xE125, disabling it.
SENDING command id 0xE140 to CWinApp target.
SENDING command id 0xE100 to CWinApp target.
SENDING command id 0xE101 to CWinApp target.

간혹 이런 디버그 메시지가 오히려 디버깅을 힘들게 하는 경우가 있는데 다음과 같이 디버깅 관련 변수를 설정하면 위의 메시지를 제거할 수 있다.

 

#if defined(_DEBUG)

   afxTraceFlags = 0;
   // *** UNCOMMENT NEXT LINE if you want multi-app debugging ***
   // afxTraceFlags |= traceMultiApp;

   // *** UNCOMMENT NEXT LINE if you want main message pump trace (includes DDE) ***
   // afxTraceFlags |= traceAppMsg;

   // *** UNCOMMENT NEXT LINE if you want Windows message tracing ***
   // afxTraceFlags |= traceWinMsg;

   // *** UNCOMMENT NEXT LINE if you want Windows command routing trace ***
   // afxTraceFlags |= traceCmdRouting;

   // *** UNCOMMENT NEXT LINE if you want special OLE callback trace ***
   // afxTraceFlags |= traceOle;

   // *** UNCOMMENT NEXT LINE if you want special database trace ***
   // afxTraceFlags |= traceDatabase;

   // *** UNCOMMENT NEXT LINE if you want special Internet client trace ***
   // afxTraceFlags |= traceInternet;
#endif /* DEBUG */

 

위와 같이 변수를 적절히 조절하여 디버그 메시지를 조절하여 출력할 수 있으며 afxTraceFlags가 NULL이 되면 아무런 메시지도 출력하지 않는다. 시점은 App가 초기화 되는 시점인 InitInstance가 적당하다.

by 이명 | 2007/07/24 23:49 | 프로그램 | 트랙백 | 덧글(0)

◀ 이전 페이지          다음 페이지 ▶