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. Enable The Button Control

Enable The Button Control

Scheduled Pinned Locked Moved C / C++ / MFC
c++visual-studiotutorial
6 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.
  • B Offline
    B Offline
    bhat
    wrote on last edited by
    #1

    Hi I am Using VS 6 And working in VC++ i want to disable the cancel button on clicking the ok button.....How to do it Edit/Delete Message

    AbidBhat

    M 1 Reply Last reply
    0
    • B bhat

      Hi I am Using VS 6 And working in VC++ i want to disable the cancel button on clicking the ok button.....How to do it Edit/Delete Message

      AbidBhat

      M Offline
      M Offline
      Maxwell Chen
      wrote on last edited by
      #2

      CWnd* p = GetDlgItem(IDCANCEL);
      p->EnableWindow(FALSE);

      Maxwell Chen

      B 1 Reply Last reply
      0
      • M Maxwell Chen

        CWnd* p = GetDlgItem(IDCANCEL);
        p->EnableWindow(FALSE);

        Maxwell Chen

        B Offline
        B Offline
        bhat
        wrote on last edited by
        #3

        Thanks But on adding these lines......it gives an error msg as error C2501: 'CWnd' : missing storage-class or type specifiers error C2501: 'p' : missing storage-class or type specifiers left of '->EnableWindow' must point to class/struct/union Error executing cl.exe.

        AbidBhat

        M 1 Reply Last reply
        0
        • B bhat

          Thanks But on adding these lines......it gives an error msg as error C2501: 'CWnd' : missing storage-class or type specifiers error C2501: 'p' : missing storage-class or type specifiers left of '->EnableWindow' must point to class/struct/union Error executing cl.exe.

          AbidBhat

          M Offline
          M Offline
          Maxwell Chen
          wrote on last edited by
          #4

          Your project is Win32 type, right?

          HWND h = ::GetDlgItem(hYourDlgHandle, IDCANCEL);
          ::EnableWindow(h, FALSE);

          Maxwell Chen

          B 1 Reply Last reply
          0
          • M Maxwell Chen

            Your project is Win32 type, right?

            HWND h = ::GetDlgItem(hYourDlgHandle, IDCANCEL);
            ::EnableWindow(h, FALSE);

            Maxwell Chen

            B Offline
            B Offline
            bhat
            wrote on last edited by
            #5

            Thanks chen yes it working fine once again thank u

            AbidBhat

            H 1 Reply Last reply
            0
            • B bhat

              Thanks chen yes it working fine once again thank u

              AbidBhat

              H Offline
              H Offline
              Hamid Taebi
              wrote on last edited by
              #6

              Or if you have handle to button you dont need to use of GetDlgItem.

              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