共用方式為


CCmdUI::SetText

Call this member function to set the text of the user-interface item for this command.

virtual void SetText(
   LPCTSTR lpszText 
);

Parameters

  • lpszText
    A pointer to a text string.

Example

void CMyRichEditView::OnUpdateLineNumber(CCmdUI *pCmdUI)
{
   int nLine = GetRichEditCtrl().LineFromChar(-1) + 1;

   CString string;
   string.Format(_T("Line %d"), nLine);
   pCmdUI->Enable(TRUE);
   pCmdUI->SetText(string);
}

Requirements

Header: afxwin.h

See Also

Reference

CCmdUI Class

Hierarchy Chart

CCmdUI::Enable

Other Resources

CCmdUI Members