
win32 insert into rich edit
By:
r00m on
Jun 7th, 2011 | syntax:
C++ | size: 0.53 KB | hits: 111 | expires: Never
void insertMessage(HWND hWnd, char *message) {
// get handle
HWND hEdit1 = GetDlgItem(hWnd, IDC_MAIN_EDIT);
// get string length
int strLen = GetWindowTextLength(hEdit1);
// allocate memory
char *buffer = new char[strLen+strlen(message)+11];
// get text
GetWindowText(hEdit1, buffer, strLen + 1);
// update window text
SetWindowText(hEdit1, buffer);
// auto scroll
SendMessage(hEdit1, WM_VSCROLL, (WPARAM)SB_BOTTOM, MAKELPARAM(FALSE, 0));
// free allocated memory
delete [] buffer;
}