Results 1 to 4 of 4

Thread: radio buttons and checkboxes!

  1. #1
    Guest

    Question

    I know how to create radio buttons and check boxes, but I need to know....


    How can you tell whether they are checked or not?


    I know i can have a boolean variable, and wait for the WM_COMMAND message, and set that variable to true. or false when one is checked... but is there a better way?


    Thanks,
    Dennis

  2. #2
    Frenzied Member Vlatko's Avatar
    Join Date
    Aug 2000
    Location
    Skopje, Macedonia
    Posts
    1,409
    If your window is a dialog then you can use this:
    Code:
    if (LOWORD(wParam)==IDC_CHECK1)
    {
            if(IsDlgButtonChecked(hDlg,IDC_CHECK1)==BST_CHECKED)
    	    {
                //do something
    	    }
             else 
    	    {
                //do something
    	    }
    }
    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
    Guest
    it's not a dialog.. it's made with CreateWindowEx(),

    thanks anyway, but I think I am going to go with the way I was originally going to.


    Dennis

  4. #4
    Guest
    My way worked fine... but incase any of you are wondering...
    there is a better way to do it.

    Code:
    int res = SendMessage(hWnd,BM_GETCHECK, 0, 0);
    
    return values
    BST_CHECKED = 1
    BST_INDETERMINATE = 2
    BST_UNCHECKED = 0

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