title: mfc access to formview item from dialog box
body: <p>In my SDI application i need to get this behawiour. After I click on a button on the FormView, a CDialog opens. When I press the OK button on the CDialog, I call a function of the FormView. I don't want to close the CDialog. I try to do it with modeless dialog, but when i call formview function from dialog, i can't access to formview's control, like it's lost hwnd; the error is can't read memory of m_hwnd, the hwnd is ???.
  This is my code:
  Open modeless dialog:</p>
  
  <pre><code>CCampiDlg *m_pDialog = NULL;
  HWND hCampi = NULL;
  
  // Invoking the Dialog
  m_pDialog = new CCampiDlg;
  
  if (m_pDialog != NULL)
  {
      BOOL ret = m_pDialog-&gt;Create(m_pDialog-&gt;IDD, this);
      if (!ret)   //Create failed.
      {
          AfxMessageBox(_T("Error creating Dialog"));
      }
      m_pDialog-&gt;ShowWindow(SW_SHOW);
  }
  </code></pre>
  
  <p>when i press the ok button in the dialog i do:</p>
  
  <pre><code>CEditorTxView pView;
  box2 = (CEdit*)(GetDlgItem(IDC_CAMPI_BOX2));
  box2-&gt;GetWindowTextW(campo);
  pView.inserisciCampo(1, campo);
  </code></pre>
  
  <p>In inserisciCampo function in CEditorTxView (CFormView) i have to do operation with my control txtCtrl, but it's lost hwnd. The declaration of txtCtrl is in the CEditorTxView.h</p>
  
  <pre><code>CTx1 txtCtrl;
  </code></pre>
  
  <p>And initialize it in DoDataExchange function:</p>
  
  <pre><code>void CEditorTxView::DoDataExchange(CDataExchange* pDX)
  {
      CFormView::DoDataExchange(pDX);
      DDX_Control(pDX, IDC_TX1, txtCtrl);
  }
  </code></pre>
  
  <p>Someone can help me plz?</p>