Re: Retrieving Arabic characters using GetWindowText?
Quote:
Originally Posted by
Ciralia
Another method I have tried is to use GetLine instead of GetWindowText, but I am unable to figure out how to get all of the lines from the RichEditCtrl into a single CString object. Here is the code I tried for that:
Code:
TCHAR tCharLine[4096];
CRichEditCtrl* myEditCtrl = GetEdit( CtrlDefiniitions::COMPOSITION_EDIT );
\\ This only gives me the first line from the RichEditCtrl, but I want all of the lines!
int nBytesCopied = myEditCtrl->GetLine(0, tCharLine, sizeof(tCharline)/sizeof(tCharLine[0]));
CString myString(tCharLine);
The 2nd code snippet gives me the proper character output but only gives me the first line from the RichEditCtrl :(. Any ideas/suggestions?
You have to use a loop and accumulate the lines one at a time. Here's what works for me:
Code:
CString text = "";
int lines = m_cEdit.GetLineCount();
for ( int i = 0; i < lines; i++ )
{
CString strText = "";
int inx = m_cEdit.LineIndex(i);
int len = max(m_cEdit.LineLength(inx), 4);
m_cEdit.GetLine(inx, strText.GetBufferSetLength(len + 1), len);
strText.SetAt(len, _T('\0')); // null terminate
strText.ReleaseBuffer();
text += strText + _T("\n");
}
// "text" now contains all lines from the CRichEditCtrl.
Re: Retrieving Arabic characters using GetWindowText?
Dear yooper,
are you sure the OP still needs some help in solving the problem he/she had more than seven years back? :confused:
Re: Retrieving Arabic characters using GetWindowText?
Whether the OP does or someone else who stumbles onto this thread, what's wrong with posting my soluction? :)
Re: Retrieving Arabic characters using GetWindowText?
Quote:
Originally Posted by
yooper
Whether the OP does or someone else who stumbles onto this thread, what's wrong with posting my soluction? :)
Nothing wrong except it is not actual.
And you could just post the link to MSDN example rather than reinvent the wheel...