title: MFC Spin Control Buddy with Edit Control Error
body: <p>I've created all my controls through the dlg resource. I've added code to control the spin control and it works perfectly. However, if I want to directly change the value of the edit box by typing a value into it, the program crashes with no error message other than "exited with return value 13."</p>
  
  <pre><code>void CNuanceGuiPart2Dlg::OnEnChangeSignalDb(){
  // TODO:  If this is a RICHEDIT control, the control will not
  // send this notification unless you override the CDialogEx::OnInitDialog()
  // function and call CRichEditCtrl().SetEventMask()
  // with the ENM_CHANGE flag ORed into the mask.
  // TODO:  Add your control notification handler code here
  }
  </code></pre>
  
  <p>If I am to add any code into the above block that contains an UpdateData call or manipulates a CEdit/CSpinControl object, it gives me a debug assert at wincore2.cpp, Line 128.</p>
  
  <p>EDIT:
  So I figured out that the function is being called too soon when the code first runs. If I wrap the entire function that is being mapped from <code>ON_EN_CHANGE</code> with a <code>if(gui_start)</code>, with <code>gui_Start</code> signaling when <code>CDialog::OnInitDialog()</code> has been executed, any updates to the GUI can run fine - I don't even get a debug runtime error. My question is: anyway I can do this without the <code>gui_Start</code>? Why is the <code>ON_EN_CHANGE</code> for this particular edit box being called so soon? Does it have to do with the spin control? Thanks in advance.</p>