Screen refresh problems

Hi everybody:

I'm doing some complex, long operations, (DataBase operations), from an application written in Builder and it's working fine, but I'm having problems for refreshing the screen when user changes focus to another app and then back to my own.
First, my window doesn't appear when the user selects my app. in the Windows TaskBar, (the only way is to force Windows -Windows XP/2000-to 'Show Desktop') and only then I can see "some" of my application's window, and I say "some", because the second, (and maybe worst) problem is that the only part of the Window I can see is the one I'm forcing to Update, (e.g a ProgressBar or StatusBar), the rest of the Window shows the backgroud color of the other application(s) the user has open.
If any of you know about a way to avoid this, please let me know,

Thanks,

Diego G.

Comments

  • Hello
    I think what You need is an additional thread in Your program. Let the thread with the background priority do the calculations while the main program form remains operational.
    try the link: http://www.programmershelp.co.uk/c++builder.php for tutorials on thread programing under Builder c++. It is easy - took me a day.
    Usually what You do is as follows:
    1. prepare all data (without any heavy calculations) in the main form
    2. create a thread object and make sure it has all data to be started with
    3. run the thread (or reasume it, depending on the mode)
    4. once the operations in the thread are done, it will self-terminate (if You follows teh tutorials it is shown there) and for the time being the main form is free for other activity.
    Once You start feeling comfortable with threads this approach works fine in all programs that have to do some heavy calculations. Sometimes I had to use up to 4 separate threads to do the job in a nice way.
    Good luck
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion