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. Disable or Enable a Button

Disable or Enable a Button

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorialquestionc++json
4 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.
  • H Offline
    H Offline
    Hachaso
    wrote on last edited by
    #1

    Hi! I'm wondering how to Disable and Enable a button. For example I'm trying to create a small program where you mark a checkbox, doing this Enables the button to continue. If it's unchecked the button is disabled. To make it disabled is easy, cause I make it as default as disabled. My problem is how do I do to Enable it when the checkbox is checked? I'm writing it in Win32 API...no MFC Please help!

    B B 2 Replies Last reply
    0
    • H Hachaso

      Hi! I'm wondering how to Disable and Enable a button. For example I'm trying to create a small program where you mark a checkbox, doing this Enables the button to continue. If it's unchecked the button is disabled. To make it disabled is easy, cause I make it as default as disabled. My problem is how do I do to Enable it when the checkbox is checked? I'm writing it in Win32 API...no MFC Please help!

      B Offline
      B Offline
      bghuang
      wrote on last edited by
      #2

      true/false

      B 1 Reply Last reply
      0
      • H Hachaso

        Hi! I'm wondering how to Disable and Enable a button. For example I'm trying to create a small program where you mark a checkbox, doing this Enables the button to continue. If it's unchecked the button is disabled. To make it disabled is easy, cause I make it as default as disabled. My problem is how do I do to Enable it when the checkbox is checked? I'm writing it in Win32 API...no MFC Please help!

        B Offline
        B Offline
        Bob Stanneveld
        wrote on last edited by
        #3

        Hello, Does the following code help?

        ::EnableWindow(::GetDlgItem(hYourDlgHandle, IDC_YOURBTNCTRLID), bEnable);

        Behind every great black man...             ... is the police. - Conspiracy brother Blog[^]

        1 Reply Last reply
        0
        • B bghuang

          true/false

          B Offline
          B Offline
          Bob Stanneveld
          wrote on last edited by
          #4

          Hachaso wrote: I'm writing it in Win32 API...no MFC Your code snippet is MFC code, Hachaso is using the Win32 API's... :doh: Behind every great black man...             ... is the police. - Conspiracy brother Blog[^]

          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