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. How to disable all controls in the dialog box

How to disable all controls in the dialog box

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
5 Posts 5 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.
  • E Offline
    E Offline
    Eugene Pustovoyt
    wrote on last edited by
    #1

    I have a modeless dialog with some controls. How to disable this dialog with all controls? Best regards, Eugene Pustovoyt


    ICQ UIN: 161325180

    A D realJSOPR J 4 Replies Last reply
    0
    • E Eugene Pustovoyt

      I have a modeless dialog with some controls. How to disable this dialog with all controls? Best regards, Eugene Pustovoyt


      ICQ UIN: 161325180

      A Offline
      A Offline
      Andy Moore
      wrote on last edited by
      #2

      Do something like this:

      BOOL b = EnumChildWindows( hWndDlg, EnumFunc, NULL );

      BOOL CALLBACK EnumFunc( HWND hwnd, LPARAM lParam )
      {
      EnableWindow( hwnd, FALSE );
      }

      Andy Human beings were not meant to sit in little cubicles staring at computer screens all day, filling out useless forms and listening to eight different bosses drone on about about mission statements. -- Peter Gibbons

      1 Reply Last reply
      0
      • E Eugene Pustovoyt

        I have a modeless dialog with some controls. How to disable this dialog with all controls? Best regards, Eugene Pustovoyt


        ICQ UIN: 161325180

        D Offline
        D Offline
        David Crow
        wrote on last edited by
        #3

        Are you wanting to disable all of the controls on the dialog, or the dialog itself?


        "The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli

        1 Reply Last reply
        0
        • E Eugene Pustovoyt

          I have a modeless dialog with some controls. How to disable this dialog with all controls? Best regards, Eugene Pustovoyt


          ICQ UIN: 161325180

          realJSOPR Offline
          realJSOPR Offline
          realJSOP
          wrote on last edited by
          #4

          Try this:

          HWND hwnd = ::GetTopWindow(this->GetSafeHwnd());
          // while we have a valid hwnd,
          // loop through all child windows
          while (hwnd)
          {
          // do something with the hwnd
          // and get the next child control's hwnd
          hwnd = ::GetNextWindow(hwnd, GW_HWNDNEXT);
          ::EnableWindow(hwnd, FALSE);
          }

          ------- sig starts "I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

          1 Reply Last reply
          0
          • E Eugene Pustovoyt

            I have a modeless dialog with some controls. How to disable this dialog with all controls? Best regards, Eugene Pustovoyt


            ICQ UIN: 161325180

            J Offline
            J Offline
            jhwurmbach
            wrote on last edited by
            #5

            If you want to disable the control on this dialog, the MFC-way of doing it would be creating a variable bool ControlsEnabled; and use OnCmdUI-Handler on each Control to do pCmdUI->Enable( ControlsEnabled /*&& other conditions*/);


            "We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation." -- Caius Petronius, Roman Consul, 66 A.D.

            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