Edit box with automatic scrollbars?
I'm trying to modify an edit box so that when the text in it exceeds its visible size, it automatically gains scrollbars. I've tried doing it like so:-
But it doesn't seem to work. Any ideas?
(in my main window's WindowProc...)
(g_hwndText = edit box)
iNumLines = SendMessage(g_hwndText, EM_GETLINECOUNT, 0, 0);
hDC = GetDC(g_hwndText);
if (rc.bottom - (iNumLines * tm.tmHeight) < 0)
dwStyle = GetWindowLong(g_hwndText, GWL_STYLE);
SetWindowLong(g_hwndText, GWL_STYLE, dwStyle | WS_VSCROLL);