CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 1999
    Posts
    4

    How to disable the ENTER key

    When in my dialog the ENTER key is hit the dialog exits. How can i disable that.


  2. #2
    Join Date
    May 1999
    Posts
    82

    Re: How to disable the ENTER key

    Add a handler for PreTranslateMessage to your dialog class like so...

    BOOL CYourDlg::PreTranslateMessage(MSG* pMsg)
    {
    if (pMsg->message == WM_KEYDOWN)
    if (pMsg->wParam == VK_RETURN)
    return TRUE;

    return CDialog::PreTranslateMessage(pMsg);
    }





  3. #3
    Join Date
    Jun 1999
    Posts
    4

    Re: How to disable the ENTER key

    I think both your time to respond and your solution were perfect.

    thanks.


Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured