In the interests of berevity, I'm only posting the code inside of the case: break;.
Code:
case ID_HTML_HEAD:
{
int length = GetWindowTextLength(GetDlgItem(hWnd, ID_EDIT));
if (length > 0)
{
char *temp = new char;
GetDlgItemText(hWnd, ID_EDIT, temp, length+1);
std::string s(temp);
s += "/* Long string */";
SetDlgItemText(hWnd, ID_EDIT, s.c_str());
delete temp;
}
else
{
SetDlgItemText(hWnd, ID_EDIT, "/* Long string */");
}
}
break;
The problem is that when I have text in my edit control with a newline (\r\n as Windows defines it), the program exits. I can't figure out how to handle this.
For example, you have text like:
<html>
<head>
<title>Blah</title>
</head>
<body>
Blah.
Thank you in advance.