- For individual users
- Instant access to solutions
- Ask your tech questions
- Start your 30-day Free Trial
Main Topics
Browse All TopicsHi All,
I am facing high performance problem when working with CListCtrl with owner draw data and styles.
When i am inserting 3000 records it takes more time. I want to avoid this delay. My idea is insert around 100 records initially and in background insert the remaining records. So user no need to wait till insert operation completes. Which is the best solution to solve this type problems. I cant change existing functionalities for Virtual list control.
Different ideas in my mind are
1) Use thread function to insert the data as background process
2) Insert the data into the list control when user scroll the list
3) Use the Peekmessage and Pump message instead of going for thread.
Please suggest me the solution/suggestion if any one faced like this problem.
Thanks.
Jerin
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: KurtVonPosted on 2006-07-11 at 14:51:40ID: 17085877
Well, you could try turning off drawing with SetRedraw until all the items have been inserted and see if that speeds things up enough to be usable.
I've also used the background inserting technique, but it requires a great deal of thread-safe programming with critical sections. Also make sure the thread knows to exit if the control it is inserting into goes away.
Peek and pump will work too, but make sure the user can't close the dialog/change the data until after everything is inserted. Since Microsoft uses this technique I suspect it is the recommended one (or at least one that won't confuse the user).
Doing it as a scroll bar is not a good idea. The size of the scroll thumb is used by most people for estimating the amount of data. Nobody will like having the thing grow every time they scroll down. Not to mention that if the data they want is near the bottom they will have to scroll 100 lines at a time . . . too much of a pain.
Hope this helps.