title: How to see if an MFC checkbox is selected
body: <p>I have checked many places for the answer to this, and they recommend the way I have done it, but it doesn't seem to work for me, so any help would be greatly appreciated.</p>
  
  <p>I have a check box and I would like it to enable an edit box when it is check and disable it when unchecked. </p>
  
  <p>The following code is what I have created:</p>
  
  <pre><code>void CMFCApplication1Dlg::OnBnClickedCheck1()
  {
      UINT nCheck = CheckBox.GetState();
      if (nCheck == BST_CHECKED)
      {
          EditBox.EnableWindow(TRUE);
      }
      else if (nCheck == BST_UNCHECKED)
      {
          EditBox.EnableWindow(FALSE);
      }
      else
      {
          EditBox.EnableWindow(TRUE);
      }
  </code></pre>
  
  <p>nCheck is 520 when I run it in debug, so goes straight to the else option.</p>
  
  <p>Many thanks</p>