title: MFC radio buttons - DDX_Radio and DDX_Control behavior
body: <p>I have an MFC dialog in which there are two radio buttons. I have put them in a nice group, their IDCs are one after each other (<code>RB_LEFT, RB_RIGHT</code>).</p>
  <p>I want to use <code>DDX_Radio</code> so I can access the buttons using an integer value so in the function <code>DoDataExchange</code> I call :</p>
  <pre><code>DDX_Radio(pDX, RB_LEFT, mRBLeftRight);
  </code></pre>
  <p>where <code>mRBLeftRight</code> is a member variable of <code>integer</code> type. I also need to edit the buttons properties so I wanted to use a <code>DDX_Control</code> to map them on member variables <code>mRBLeft</code> and <code>mRBRight</code> (<code>CButton</code>):</p>
  <pre><code>DDX_Control(pDX, RB_LEFT, mRBLeft);
  DDX_Control(pDX, RB_RIGHT, mRBRight);
  </code></pre>
  <p>Now if I do the call to <code>DDX_Control</code>, whenever <code>DoDataExchange</code> is called, the application crashes because <code>DDX_Control</code> forces <code>RB_LEFT</code> to handle a message that <code>DDX_Radio</code> cannot handle. This part I understand.</p>
  <p>I decided to not use <code>DDX_Control</code> (removed the calls in <code>DoDataExchange</code>) and just keep a pointer to my radio buttons (<code>CButton*</code>) in my classes. So in my <code>OnInitDialog</code> function, I do the following calls :</p>
  <pre><code>mRBLeft= ((CButton*)GetDlgItem(RB_LEFT));
  mRBRight = ((CButton*)GetDlgItem(RB_RIGHT));
  </code></pre>
  <p>Now as long as I don't use <code>mRBLeft</code> it's going to be fine, but if I do, bam, crash on <code>DoDataExchange</code>. The thing that really puzzles me is if I change my left radio button using
  <code>((CButton*)GetDlgItem(RB_LEFT)-&gt;SetCheck(true)</code>
  it's going to work. Sooo what's the difference ?</p>
  <p>(I know it's a lot of hassle for little, but I just wanna understand the mechanics)</p>