Suppose you want to write the following "three lines" of content into a multi-line edit box,
First line: "《天龙八布》";
Second line: "《新闻联播》";
Third line: "《我爱我家》";
It should be like this:
------------------------------------------
void Demo_WriteEdit(CMultiEdit* pMultiEdit)
{
DWORD dwLoc;
int nLength;
char* pStr1 = "《天龙八布》";
char* pStr2 = "《新闻联播》";
char* pStr3 = "《我爱我家》";
// Allocate a new line
nLength = _fstrlen(pStr1) + 1; // Calculate the string length
dwLoc = pMultiEdit->m_XmsMemoryData.New (nLength, FALSE); // Allocate memory
// Write the string to memory
if (dwLoc != 0L)
{
pMultiEdit->m_XmsMemoryData.SetText(dwLoc, pStr1, nLength);
}
// Allocate a new line
nLength = _fstrlen(pStr2) + 1; // Calculate the string length
dwLoc = pMultiEdit->m_XmsMemoryData.New (nLength, FALSE); // Allocate memory
// Write the string to memory
if (dwLoc != 0L)
{
pMultiEdit->m_XmsMemoryData.SetText(dwLoc, pStr2, nLength);
}
// Allocate a new line
nLength = _fstrlen(pStr3) + 1; // Calculate the string length
dwLoc = pMultiEdit->m_XmsMemoryData.New (nLength, FALSE); // Allocate memory
// Write the string to memory
if (dwLoc != 0L)
{
pMultiEdit->m_XmsMemoryData.SetText(dwLoc, pStr3, nLength);
}
}