ParentSadly I didn’t find an answer with google by searching for "laggy/slow mouse wheel-scrolling in Rich Edit control" and similar sentence.
I created a rich edit control (5.0) as a child, added the styles WS_VISIBLE, WS_CHILD, WS_VSCROLL, ES_READONLY, ES_MULTILINE, ES_NOHIDESEL, ES_AUTOVSCROLL and subclassed the messagehandler callback. After appending ~200 text lines the VScroll moves very laggy if I use the mouse wheel. With laggy I mean that the thumb of the rich edit Vscrollbar is still scrolling while I already stopped scrolling with my mouse wheel. Scrolling by clicking the thumb and move it around works fine.
Currently I have no idea why this happens. Someone maybe know why the mouse wheel scrolling is so laggy and how to fix this crazy issue?
Edit: I tested it now also without subclassing directly new project with only a parent window. It has still the same issue there if i write ~ 200 lines. This is the code i use to creat the rich edit control:
ATOM MyRegisterClass(HINSTANCE hInstance){
WNDCLASSEX wcex;
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = WndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = hInstance;
wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_BUGTEST));
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wcex.lpszMenuName = MAKEINTRESOURCE(IDC_BUGTEST);
wcex.lpszClassName = szWindowClass;
wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));
return RegisterClassEx(&wcex);
}
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow){
HWND hWnd;
hInst = hInstance;
hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
if (!hWnd)
{
return FALSE;
}
ShowWindow(hWnd, nCmdShow);
LoadLibraryA("Msftedit.dll");
wstring w_classname = wstring(MSFTEDIT_CLASS);
string classname = string(w_classname.begin(), w_classname.end());
HWND richedit = CreateWindowExA(
WS_EX_CLIENTEDGE,
classname.c_str(),
"richedit",
WS_CHILD | WS_VISIBLE | WS_VSCROLL | ES_NOHIDESEL | ES_MULTILINE | ES_AUTOVSCROLL | ES_LEFT,
200, 300,
400, 500,
hWnd,
NULL,
hInstance,
NULL
);
UpdateWindow(hWnd);
return TRUE;
}
hProgrammInstance
is the wrong module handle. The control implementation is in Msftedit.dll, not your in your application module. – IInspectable