mfc 设置弹出框文本

 时间:2024-10-25 09:19:00

1、主要依赖SetWindowText函数。首先给编辑框关联一个CEdit类型的变量。(右键编辑框,添加变量就可以)然后调用SetWindowText函数,传入CString类型的参数。

mfc 设置弹出框文本

2、函数原型:CWnd::SetWindowTextvoid SetWindowText(LPCTSTRlpszString );

mfc 设置弹出框文本

3、范例(来源于MSDN):Example// set the text in 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);

mfc 设置弹出框文本
  • OpenCV:在图像上显示文本信息
  • eclipse如何新建工作组working sets
  • windows上 安装 wireshark 教程
  • C#winform怎么自定义日期控件格式
  • 如何在电脑windows系统中卸载pycharm软件
  • 热门搜索
    怎么看朋友圈访客记录 营业税怎么计算 旅游帽 如何删除页码 路由器管理软件 旅游纪录片 五十肩是怎么回事 爱旅游网 旅游人才 如何盗qq