-Mike
____________________________________________________________________
//turn updating off (same as LockWindowUpdate(ListView1->Handle))
ListView1->Perform(WM_SETREDRAW, false, 0);
for (int index = 1; index < 500; index++)
{
TListItem *NewItem = ListView1->Items->Add();
NewItem->Caption = "ListItem" + IntToStr(index);
}
//turn updating back on (same as LockWindowUpdate(NULL))
ListView1->Perform(WM_SETREDRAW, true, 0);
_____________________________________________________________________
Try the code with and without the WM_SETREDRAW message, and you'll see a
huge difference in execution time. Hope this clears things up.
//Damon
-------------------------------------
http://bcbcaq.freeservers.com
Answers to <Commonly Asked Questions>
>//turn updating off (same as LockWindowUpdate(ListView1->Handle))
>ListView1->Perform(WM_SETREDRAW, false, 0);
The only thing I have to add here is that in real-world code this
should be protected in a try __finally:
ListView1->Perform(WM_SETREDRAW, false, 0);
try
{ ... }
__finally
{
ListView1->Perform(WM_SETREDRAW, true, 0);
}
--
Stefan Hoffmeister (TeamB) http://www.econos.de/
Please do apply judgement when sending email.
I've been otherwise occupied the last couple of weeks and haven't had a
chance to get back here. My problem is when I use WM_SETREDRAW with a
MDIParent form, it doesn't seem to inhibit the drawing of my child forms
(LockWindowUpdate does, although with some flicker on the desktop). Any
further help would be appreciated.
- Mike
- Mike