0

I have got a list view common control in one window. I have a mechanism that updates the list from within the same window (it works like a charm). However, I got this requirement that I have to update the view from an outside entity, like a dialog or another window altogether. This is where the problem arises.

The list view doesn't get updated when an item is Inserted from outside the window boundary. I have tried doing UpdateWindow() calls in every possible List View NOTIFICATION message there is, but to no avail. I wish someone could help me out on this.

Also, the list view DOES get updated with a new item/row when the whole application window is minimized and drawn back. Weird.

Vijay Kumar Kanta
  • 1,111
  • 1
  • 15
  • 25

1 Answers1

1

Oh, yeah, thanks to @Remy Lebeau for giving right solution in the comment. This is what he gave

/* window procedure of window where list view exists as a control */
case WM_NOTIFY:
    switch(((LPNMHDR) lParam)->code) {
        case LVN_INSERTITEM:
            ListView_RedrawItems(hMyList, 0, lastIndex);
            UpdateWindow(hMyList);
            UpdateWindow(hwnd); /* the parent window */
            ...

Hope this helps someone else looking for a solution.

Vijay Kumar Kanta
  • 1,111
  • 1
  • 15
  • 25