CButton myCheckbox; // Declare a CButton instance // Assume the checkbox was previously created and initialized with a control ID myCheckbox.SetCheck(BST_CHECKED); // Set checkbox to checked state
CButton radio1; CButton radio2; // Assume radio1 and radio2 were previously created and initialized with control IDs radio1.SetCheck(BST_CHECKED); // Set radio1 to checked state radio2.SetCheck(BST_UNCHECKED); // Set radio2 to unchecked state // Now toggle between the two radio buttons radio1.SetCheck(BST_UNCHECKED); radio2.SetCheck(BST_CHECKED);In this example, we declare two CButton instances called `radio1` and `radio2` and assume they were previously created and initialized with control IDs. We use the `SetCheck` method to set `radio1` to the checked state and `radio2` to the unchecked state. We then toggle between the two radio buttons by using `SetCheck` again to switch their states. The package library for these examples is likely MFC (Microsoft Foundation Classes), which provides C++ classes for developing Windows desktop applications.