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. Inhibe the ENTER and ESC KEYS ?

Inhibe the ENTER and ESC KEYS ?

Scheduled Pinned Locked Moved C / C++ / MFC
question
5 Posts 4 Posters 2 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.
  • Y Offline
    Y Offline
    youssef
    wrote on last edited by
    #1

    Hi, I created a project. I deleted the OK and CANCEL buttons. But when I execute my project and I press the ESC or ENTER KEYS, the project is stopped. How can I do for inhibe this KEYS? Best Regards youssef

    L W L 3 Replies Last reply
    0
    • Y youssef

      Hi, I created a project. I deleted the OK and CANCEL buttons. But when I execute my project and I press the ESC or ENTER KEYS, the project is stopped. How can I do for inhibe this KEYS? Best Regards youssef

      L Offline
      L Offline
      lucy 0
      wrote on last edited by
      #2

      ;) I have this problem before as well. Although the button is not there, but you still have invisible OnOK() and OnCancel() function working for you! would you say it a feature or a bug? ;) what I did is to overwrite the above two functions, and say if these two buttons don't have input focus, just return. Something like this: if ( GetFocus() != GetDlgItem(IDOK)) return; else CDialog::OnOK();

      1 Reply Last reply
      0
      • W wangyiming

        void CMyDialog::OnOk() { } void CMyDialog::OnCancel() { }

        L Offline
        L Offline
        lucy 0
        wrote on last edited by
        #3

        hmm, nice idea.

        1 Reply Last reply
        0
        • Y youssef

          Hi, I created a project. I deleted the OK and CANCEL buttons. But when I execute my project and I press the ESC or ENTER KEYS, the project is stopped. How can I do for inhibe this KEYS? Best Regards youssef

          W Offline
          W Offline
          wangyiming
          wrote on last edited by
          #4

          void CMyDialog::OnOk() { } void CMyDialog::OnCancel() { }

          L 1 Reply Last reply
          0
          • Y youssef

            Hi, I created a project. I deleted the OK and CANCEL buttons. But when I execute my project and I press the ESC or ENTER KEYS, the project is stopped. How can I do for inhibe this KEYS? Best Regards youssef

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            you have to write and add these functions to your project: void CMyproject::OnCancel(){ } void CMyproject::OnOk(){ }

            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