Thanks for the answer! But it doesn't solve anything..!
Yes, the 'sorted' flag was true. So, I turn it off, and
rebuild my application, and try again. Not better..!
I use InsertString, always with the right index just over
the last item in the list.
My application take only 2,5 second to load thioses
75,000 items. And then take 3min 20 seconds to display!
It take almost no time, when I modify my application to display
only the first 50 items.
Like I said, the right bussiness strategy is to display around 2000
items. My customer fully agree with that. There is no Show Stopper
here, then. I post this question on the newsgroup, just hoping to learn
a little more about Windows widgets...
Thanks anyway!..
jmarc...
>> Doesn't seems to work!
>>
[quoted text clipped - 29 lines]
>
> Sean
Tamas Demjen - 10 May 2006 19:48 GMT
> My application take only 2,5 second to load thioses
> 75,000 items. And then take 3min 20 seconds to display!
> It take almost no time, when I modify my application to display
> only the first 50 items.
Every time you add a new item to a list box, you're sending a WM message
to it, and that's extremely inefficient. By deault, the list box owns
the strings, and it was designed to handle a few items only. If you need
to display 1000s of items, you need to program a virtual list box. That
means you don't feed the strings to the list box, all you do is tell the
number of items, and supply the strings on demand, always for the
currently visible items only.
To implement a virtual list box, use the flag LBS_NODATA instead of
LBS_HASSTRINGS (when you create the control). Send an LB_SETCOUNT
message to tell the control the number of items. Handle LB_GETTEXTLEN
and LB_GETTEXT to feed the strings from your own container to the list
box. You should not call AddString to add items to the list box. I don't
know the specific details regarding how to do this in MFC, but this is
the basic idea.
You'll be surprise how much faster it will work.
Tom
jmarc - 12 May 2006 17:19 GMT
Thanks a lot, Tamas..
Your explanation is very helpfull.
It is important to know what wrong before
applying any solution.
I will be alble to find out how to proceed
in C++...
Thanks again..!
jmarc
>> My application take only 2,5 second to load thioses
>> 75,000 items. And then take 3min 20 seconds to display!
[quoted text clipped - 20 lines]
>
> Tom