I'd like to prevent my window from being updated until I finish receiving data from the server and render it. Can I hook on the WM_PAINT event, or better still call some Win32API method to prevent the window from being updated and unfreeze it later?
More info: In the context of an MMC snapin written in C#, our application suffers from annoying flickering and double sorting behaviour: We use MMC's listViews, but since we subscribe to the sort event. MMC does it's own magic and sorts the page being displayed (and we can't override that), and when we receive a reply from our server we change the listView again. each row change is done sequentially, there's no beginUpdate etc. (AFAIK).
Normally hooking into WM_PAINT
is the way to go, but make sure you also ignore all WM_ERASEBKGND
notifcations, otherwise you'll still get flicker, because Windows erases the Windows area for you. (Return non-zero to prevent Windows from doing that)
One other possibility is to use the LockWindowUpdate
function, but it has some drawbacks: