是否可以在对话框DoMode()之前改变对话框的一些数据,如框题或其中标签的名称等等

解决方案 »

  1.   

    Sets the window's title to the specified text.void SetWindowText(
       LPCTSTR lpszString 
    );
    Parameters
    lpszString 
    Points to a CString object or null-terminated string to be used as the new title or control text. 
    Res
    If the window is a control, the text within the control is set. This function causes a WM_SETTEXT message to be sent to this window.Example
    // set the text in IDC_MYEDIT
    CWnd* pWnd = GetDlgItem(IDC_MYEDIT);
    pWnd->SetWindowText(_T("Hockey is best!"));// Get the text back. CString is convenient, because MFC
    // will automatically allocate enough memory to hold the
    // text--no matter how large it is.CString str;
    pWnd->GetWindowText(str);
    ASSERT(str == _T("Hockey is best!"));// The LPTSTR override works, too, but it might be too short.
    // If we supply a buffer that's too small, we'll only get those
    // characters that fit.TCHAR sz[10];
    int nRet = pWnd->GetWindowText(sz, 10);// Nine characters, plus terminating null
    ASSERT(lstrcmp(sz, _T("Hockey is")) == 0);
    ASSERT(nRet == 9);// You can query the length of the text without the length of
    // the string using CWnd::GetWindowTextLength()
    nRet = pWnd->GetWindowTextLength();
    ASSERT(nRet == 15);
      

  2.   

    可以啊,
    对于对话框的标题,你需要在对话框类里面建立一个成员变量,然后在OnInitDialog()函数中SetWindowText(m_strTitle);
    对于那些控件只要你为他们建立一个DDV的成员变量就可义了.
    在你domodel对话框之前对这些成员变量进行设置。
      

  3.   

    在domodal之前将一些值赋给对话框对象的某些变量然后在其OnInitDialog中用楼上的setwindowtext
      

  4.   

    老兄不是以为我不知道如何设置对话框标题吧^0^我是想问为什么我声名的某对话框的对全局变量,为什么用DoMode()什么出错呀,是不是有可以在DoMode()之前改变对话框参数呀
      

  5.   


    class CYourDialog : public CDialog
    {
      public:
      CLabel m_label;
     .......................
    }
    CYourDialog  YourDialog;
    YourDialog.m_label = "test";
    YourDialog.DoMode();