能否给个非常简短的代码片断,用以说明问题?谢谢!

解决方案 »

  1.   

    SDK只能直接调用API,MFC的DDE也不过只是对控件和变量交换数据的一种封装。
      

  2.   

    再顶一下,bz大人帮帮忙哈! 
    用Win32 api如何实现一个TextBox的hWnd和一个char []变量,实现数据交换?谢谢!
      

  3.   


    放心,这个只能自己封装。你可以参考MFC的DDX_Control实现:
    void AFXAPI DDX_Control(CDataExchange* pDX, int nIDC, CWnd& rControl)
    {
    if ((rControl.m_hWnd == NULL) && (rControl.GetControlUnknown() == NULL))    // not subclassed yet
    {
    ASSERT(!pDX->m_bSaveAndValidate); pDX->PrepareCtrl(nIDC);
      HWND hWndCtrl;
      pDX->m_pDlgWnd->GetDlgItem(nIDC, &hWndCtrl);
    if ((hWndCtrl != NULL) && !rControl.SubclassWindow(hWndCtrl))
    {
    ASSERT(FALSE);      // possibly trying to subclass twice?
    AfxThrowNotSupportedException();
    }
    #ifndef _AFX_NO_OCC_SUPPORT
    else
    {
     if (hWndCtrl == NULL)
     {
    if (pDX->m_pDlgWnd->GetOleControlSite(nIDC) != NULL)
    {
       rControl.AttachControlSite(pDX->m_pDlgWnd, nIDC);
    }
     }
     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 }
    }
    说白了就是子类化控件。
    你看看这篇文章的分析:http://wangzilue.spaces.live.com/blog/cns!F3E795BA961DF45!126.entry