所以這裏是我的問題,它工作正常,直到它達到一定數量的數據。例如,我無法顯示一個完整的HTML文件,例如在它被切斷的窗口中大約1MB。將文本追加到空間不足的編輯控件上?
窗口:
case WM_CREATE:
hEdit = CreateWindowEx(WS_EX_CLIENTEDGE, "EDIT", "",
WS_CHILD | WS_VISIBLE | WS_VSCROLL | ES_READONLY | WS_HSCROLL | ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL,
0, 0, 100, 100, hWnd, (HMENU)IDC_MAIN_EDIT, GetModuleHandle(NULL), NULL);
if(hEdit == NULL)
MessageBox(hWnd, "Could not create edit box.", "Error", MB_OK | MB_ICONERROR);
hfDefault = (HFONT)GetStockObject(DEFAULT_GUI_FONT);
SendMessage(hEdit, WM_SETFONT, (WPARAM)hfDefault, MAKELPARAM(FALSE, 0));
LogText(hEdit,logstring);
break;
功能:
void LogText(HWND hEdit, const char * logstring)
{
const char * logstring2="\r\n";
int iLength = GetWindowTextLength(hEdit);
SendMessage(hEdit, EM_SETSEL, iLength, iLength);
SendMessage(hEdit, EM_REPLACESEL, 0, (LPARAM) logstring);
SendMessage(hEdit, WM_VSCROLL, SB_BOTTOM, (LPARAM)NULL);
int iLength2 = GetWindowTextLength(hEdit);
SendMessage(hEdit, EM_SETSEL, iLength2, iLength2);
SendMessage(hEdit, EM_REPLACESEL, 0, (LPARAM) logstring2);
SendMessage(hEdit, WM_VSCROLL, SB_BOTTOM, (LPARAM)NULL);
}
用法:
logstring="Test";
LogText(hEdit, logstring);
就像我說的,它的作品完美,但它停止其吐出一個未知量後工作我注意到的數據是非常一致的數字。
您是否試過用['EM_LIMITTEXT'](http://msdn.microsoft.com/en-us/library/windows/desktop/bb761607.aspx)調整上限? – 2012-03-31 06:33:11
非常感謝。 – doublesaces 2012-03-31 16:53:02