Results 1 to 3 of 3

Thread: How do I use Radio Buttons (and checkboxes)?

  1. #1
    Ragnar
    Guest

    How do I use Radio Buttons (and checkboxes)?

    I have added 2 radio buttons on my form. What is the code for checking which radiobuttons are true?
    Oh and can you guys please say the code for checking which checkboxes are true?

    Thanks.

  2. #2
    Frenzied Member Vlatko's Avatar
    Join Date
    Aug 2000
    Location
    Skopje, Macedonia
    Posts
    1,409
    You can use
    IsDlgButtonChecked
    The IsDlgButtonChecked function determines whether a button control has a check mark next to it or whether a three-state button control is grayed, checked, or neither.

    UINT IsDlgButtonChecked(
    HWND hDlg, // handle to dialog box
    int nIDButton // button identifier
    );

    Parameters
    hDlg
    Handle to the dialog box that contains the button control.
    nIDButton
    Specifies the integer identifier of the button control.
    Return Values
    The return value from a button created with the BS_AUTOCHECKBOX, BS_AUTORADIOBUTTON, BS_AUTO3STATE, BS_CHECKBOX, BS_RADIOBUTTON, or BS_3STATE style can be one of the following:

    Value Meaning
    BST_CHECKED Button is checked.
    BST_INDETERMINATE Button is grayed, indicating an indeterminate state (applies only if the button has the BS_3STATE or BS_AUTO3STATE style).
    BST_UNCHECKED Button is unchecked


    If the button has any other style, the return value is zero.

    Remarks
    The IsDlgButtonChecked function sends a BM_GETCHECK message to the specified button control.
    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
    Megatron
    Guest
    Code:
    if( SendMessage(hwndRadio, BM_GETSTATE, 0, 0) == BST_CHECKED)
        // Button is checked

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