“DDX_Control”: 不能将参数 3 从“CEdit *(__cdecl *)(CEdit *)”转换为“CWnd &”
我是想dll中封装的类指针与资源绑定呀typedef CEdit* (*lpCall)(CEdit*);
CEdit* ExportCEdit(CEdit* pParam)
{
    return new CEdit();
}lpCall pFunc = ExportCEdit;
DDX_Control(pDX, IDC_EDIT1, pFunc);

解决方案 »

  1.   

    typedef CEdit* (*lpCall)(CWnd*);
      

  2.   

    写一个基于指针的 DDX_Control 或者直接使用 SubclassWindow
    void AFXAPI DDX_Control(CDataExchange* pDX, int nIDC, CWnd *rControl)
    {
      if (rControl && rControl->m_hWnd == NULL)    // not subclassed yet
      {
        ASSERT(!pDX->m_bSaveAndValidate);
        
        HWND hWndCtrl = pDX->PrepareCtrl(nIDC);
        
        if (!rControl->SubclassWindow(hWndCtrl))
        {
          ASSERT(FALSE);      // possibly trying to subclass twice?
          AfxThrowNotSupportedException();
        }
    #ifndef _AFX_NO_OCC_SUPPORT
        else
        {
          // If the control has reparented itself (e.g., invisible control),
          // make sure that the CWnd gets properly wired to its control site.
          if (pDX->m_pDlgWnd->m_hWnd != ::GetParent(rControl->m_hWnd))
            rControl->AttachControlSite(pDX->m_pDlgWnd);
        }
    #endif //!_AFX_NO_OCC_SUPPORT
        
      }
    }