Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Dialog closes on Escape

Dialog closes on Escape

Scheduled Pinned Locked Moved C / C++ / MFC
help
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    krugger
    wrote on last edited by
    #1

    Hi all; I have an application which has a log-in menu. The whole stuff works fine but the only problem is that if a user hits "Escape" while my log-in menu is on, the thing just disappears leaving him/her with all the program functionality without even logging on the system!! Obviously something's going wrong! Can u please help me to stop the dialog from closing when i hit Escape. Thank you guys; Regards Krugger

    M A 2 Replies Last reply
    0
    • K krugger

      Hi all; I have an application which has a log-in menu. The whole stuff works fine but the only problem is that if a user hits "Escape" while my log-in menu is on, the thing just disappears leaving him/her with all the program functionality without even logging on the system!! Obviously something's going wrong! Can u please help me to stop the dialog from closing when i hit Escape. Thank you guys; Regards Krugger

      M Offline
      M Offline
      Michael Dunn
      wrote on last edited by
      #2

      See the FAQ 7.4 How do I prevent a dialog from closing when the user presses Enter or Esc?[^] --Mike-- Personal stuff:: Ericahist | Homepage Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ "That probably would've sounded more commanding if I wasn't wearing my yummy sushi pajamas."   -- Buffy

      1 Reply Last reply
      0
      • K krugger

        Hi all; I have an application which has a log-in menu. The whole stuff works fine but the only problem is that if a user hits "Escape" while my log-in menu is on, the thing just disappears leaving him/her with all the program functionality without even logging on the system!! Obviously something's going wrong! Can u please help me to stop the dialog from closing when i hit Escape. Thank you guys; Regards Krugger

        A Offline
        A Offline
        alex barylski
        wrote on last edited by
        #3

        I use this approach:

        BOOL CDejavuDlg::PreTranslateMessage(MSG* pMsg)
        {
        // Prevent escape key from closing application window
        if(pMsg->message == WM_KEYDOWN && (pMsg->wParam == VK_ESCAPE || pMsg->wParam == VK_RETURN))
        return FALSE;

        return CDialog::PreTranslateMessage(pMsg);
        

        }

        The word of the day is legs, let's go back to my house and spread the word ;P

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups