mfc 设置弹出框文本
1、主要依赖SetWindowText函数。首先给编辑框关联一个CEdit类型的变量。(右键编辑框,添加变量就可以)然后调用SetWindowText函数,传入CString类型的参数。
2、函数原型:CWnd::SetWindowTextvoid SetWindowText(LPCTSTRlpszString );
3、范例(来源于MSDN):Example// set the text i艘绒庳焰n IDC_MYEDITCWnd* pWnd = GetDlgItem(IDC_MYEDIT);pWnd->SetWindowText(_T("Hockey is best!"));// Get the text back. CString is convenient, becauseMFC// 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!"));// TheLPTSTRoverride works, too, but it might be too short.// If we supply a buffer that's too small, we'll only get those// characters thatfit.TCHARsz[10];int nRet = pWnd->GetWindowText(sz, 10);// Nine characters, plus terminating nullASSERT(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);