//以下是取出所有行的字符串,输出显示 // The pointer to my rich edit control. extern CRichEditCtrl* pmyRichEditCtrl; int i, nLineLength, nLineCount = pmyRichEditCtrl->GetLineCount(); CString strText, strLine; // Dump every line of text of the rich edit control. for (i=0;i < nLineCount;i++) { nLineLength = pmyRichEditCtrl->LineLength(i); pmyRichEditCtrl->GetLine(i, strText.GetBuffer(nLineLength)); strText.ReleaseBuffer(nLineLength); strLine.Format(TEXT("line %d: '%s'\r\n"), i, strText.GetBuffer(0)); afxDump << strLine; } //取当前行的字符串送到strText CSrting strText; nLine= pmyRichEditCtrl->LineFromChar(-1);//取得nIndex pmyRichEditCtrl->GetLine(i, strText.GetBuffer(nLine)); strText.ReleaseBuffer(nLineLength);
GetDlgItem(IDC_EDIT1)->GetWindowText(str);
我是想得到行的字符,可是我用了EM_GETLINE不能得到字符指针???还请各位大虾帮忙啊
// The pointer to my rich edit control.
extern CRichEditCtrl* pmyRichEditCtrl; int i, nLineLength, nLineCount = pmyRichEditCtrl->GetLineCount();
CString strText, strLine; // Dump every line of text of the rich edit control.
for (i=0;i < nLineCount;i++)
{
nLineLength = pmyRichEditCtrl->LineLength(i);
pmyRichEditCtrl->GetLine(i, strText.GetBuffer(nLineLength));
strText.ReleaseBuffer(nLineLength); strLine.Format(TEXT("line %d: '%s'\r\n"), i, strText.GetBuffer(0));
afxDump << strLine;
} //取当前行的字符串送到strText
CSrting strText;
nLine= pmyRichEditCtrl->LineFromChar(-1);//取得nIndex
pmyRichEditCtrl->GetLine(i, strText.GetBuffer(nLine));
strText.ReleaseBuffer(nLineLength);