Results 1 to 3 of 3

Thread: Enable/diable push button?

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,091
    Hi,

    I want to be able to enable/disable a push button on a dialog box. What I mean by that is: If I disable the button, it should be greyed out and not be able to be pushed.

    Someone said use EnableWindow() but that requires a handle. Is this the correct function to use? If so, how do I determine the handle to a particular button?

    Thanks,

    Dan

    Visual Studio 2010

  2. #2
    Frenzied Member Vlatko's Avatar
    Join Date
    Aug 2000
    Location
    Skopje, Macedonia
    Posts
    1,409
    If you are using a dialog (the button is on the dialog) then:
    Code:
    EnableWindow(GetDlgItem(HwndofDialog,controlID) ,FALSE);
    else you can always use FindWindow and FindWindowEx:
    Code:
    HWND FindWindow(
      LPCTSTR lpClassName,  // pointer to class name
      LPCTSTR lpWindowName  // pointer to window name
    );
    
    HWND FindWindowEx(
      HWND hwndParent,      // handle to parent window
      HWND hwndChildAfter,  // handle to a child window
      LPCTSTR lpszClass,    // pointer to class name
      LPCTSTR lpszWindow    // pointer to window name
    );
    I am become death, the destroyer of worlds.
    mail:[email protected]

    • Visual Basic 6.0 & .NET
    • Visual C++ 6.0 & .NET
    • ASP
    • LISP
    • PROLOG
    • C
    • Pascal

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,091
    Thanks! worked like a charm..

    Visual Studio 2010

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width