Hello everybody,

I have two toolbars in my rebar. One is a menu toolbar. If I click on a menu item the program performs a recursive file search. This can take a few seconds and while the search is taking place a narrow white rectangle is left on the rebar. I try to get rid of this by re-painting the rebar using this code:

invoke SendMessage, lParam, TB_GETITEMRECT, bindex, ADDR Rct
invoke GetClientRect,hFileMenu,ADDR Rct
invoke GetLastError
invoke InvalidateRect,hFileMenu,ADDR Rct,FALSE
invoke GetLastError

both GetClientRect and InvalidateRect return 0 and GetLastError returns 0 (maybe because I'm using windows98)

If I use:
invoke MoveWindow,hRebar,0,0,0,0,TRUE

this repaints entire screen and it goes white while search is being done.


Any help or suggestions much appreciated

best regards,

czDrillard
Posted on 2003-03-06 10:33:17 by czDrillard
I have no suggestion about the functions returning NULL (I guess invalid HWNDs), but InvalidateRect should be followed by Updatewindow to perform a synchronous paint operation.
Posted on 2003-03-06 11:21:40 by japheth
Are you doing that recursive search inside your WndProc? If yes, you shouldn't do that. It will block all messages while your program and that's bad, not just for the painting. You won't fix that by sticking in a few repaints. Instead, create a separate thread for the search that notifies your main window (via a custom message) when it's done searching.

Thomas
Posted on 2003-03-06 13:45:25 by Thomas
Thanks to everybody for their replies:)

Changing from the menu handle to the rebar handle and calling UpdateWindow fixed the problem. And yes Thomas, you are right. The search is part of the window proc and everthing is disabled while search continues. I'll do as you suggest and create a separate thread.

best regards,

czDrillard
Posted on 2003-03-07 09:29:07 by czDrillard