+ Reply to Thread
Results 1 to 2 of 2

Thread: Avoid Esacpe key from exiting dialog box?

  1. #1

    Avoid Esacpe key from exiting dialog box?

    I have a dialog box.

    Whenever user presses escape, dialog exits.

    Hot to avoid Esacpe key from exiting dialog box?

  2. #2
    Senior Member
    Join Date
    Feb 2012
    Posts
    109
    Override PreTranslateMessage method as described below.

    Example:

    Code:
    BOOL CTestMFCCodeExpertsDlg::PreTranslateMessage(MSG* pMsg) 
    {
    	// TODO: Add your specialized code here and/or call the base class
    	if(pMsg->message==WM_KEYDOWN)
        {
    		if(pMsg->wParam==VK_ESCAPE)
    		{
    			return TRUE ;
    		}
    	}
    	return CDialog::PreTranslateMessage(pMsg);
    }

+ Reply to Thread

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts