2009년 11월 5일 목요일

[MFC] enter, esc 키 눌렀을 때 종료되는 현상 막기!

다이얼로그 기반 속성창에서 PreTranslateMessage 함수를 추가 한 후,

다음과 같이 작성하면 된다.

 

 

 

BOOL 다이얼로그 이름::PreTranslateMessage(MSG* pMsg)
{

                // enter key
                if(pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN)
                {

                             return TRUE; 

                }

                 // esc key
                  else if(pMsg->message == WM_KEYDOWN)
                  {

                                  if(pMsg->wParam == VK_ESCAPE) return TRUE;
                                  if(pMsg->wParam == VK_RETURN) return TRUE;

                  }

                 

                 return CDialog::PreTranslateMessage(pMsg);

}

 

 

댓글 없음:

댓글 쓰기