OS: Win7
list box is not updating its region after
SendMessage(hwndListData, LB_ADDSTRING, 0, (LPARAM) szListMainBuffer);
If mouse cursor is hovered over blank line that should contain text from szListMainBuffer, and clicked, text appears. I have tried using UpdateWindow(), InvalidateRect() functions targeted at hwndListData and parent window, for no effect.
Does someone knows how to solve refreshing of listbox after string insertion?
hwndListData = CreateWindow(TEXT("listbox"), L"Data List",
WS_CHILDWINDOW | WS_VISIBLE | LBS_NOTIFY | WS_VSCROLL | WS_HSCROLL | WS_BORDER,
cxChar * 50, cyChar,
cxChar * 38 + GetSystemMetrics(SM_CXVSCROLL), cyChar * 26 + GetSystemMetrics(SM_CYHSCROLL),
hwnd, (HMENU) ID_LISTDATA,
(HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE),
NULL);
Addition:
Global scope: WNDPROC oldListDataProcedure;
During WM_CREATE: oldListDataProcedure = (WNDPROC) SetWindowLong (hwndListData, GWL_WNDPROC, (LPARAM) ListDataProc);
LRESULT CALLBACK ListDataProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) {
return CallWindowProc(oldListDataProcedure, hwnd, message, wParam, lParam);
}