Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Program goes blank after screensaver starts

Status
Not open for further replies.

PaidtheUmpire

Programmer
Jan 4, 2004
105
AU
I have a program that has a huge loop which takes over an hour to run through...

Doing the following:

Collects Files
Insert File 1
Insert File 2 etc...
Finish

But if someone runs the program then walks away, the computer goes into screensaver mode. When the person comes back and trys to watch to see how the program is going, all they get is the border of the program and the program details are all white...

I think that the computer is using all its memory on running the files through it isn't updating/showing the screen.

Any ideas?

PS. Sorry for not being extremely clear.


Delphi I can't get enough of you.
 
You could try inserting Application.ProcessMessages into your loop. If one doesn't help, try with two or three.

Small example:
Code:
repeat 
  Application.ProcessMessages;
  DoSomething;
  Application.ProcessMessages;
  DoAnotherThing;
  Application.ProcessMessages;
  DoMoreThings;
until SomethingComesTrue;

JP
 
Have a look at the onactivate method

procedure TNetBackUp.FormCreate(Sender: TObject);
begin
Application.OnActivate := AppActivate;
end;


This might be called when the screensaver is quit out and you can do a refresh of the form or whatever in the AppActivate function

I use it to force a redraw of a control like this:-

procedure TNetBackUp.AppActivate(Sender: Tobject);
begin
if wizard.visible then
RestorePage(wizard.activepage);
end;

maybe you can do formname.refresh


Steve
DNA still on the way, as is the new release of Star............
 
Because of the loop keeping the program busy it wont update itself automatically anymore, youll need to use Application.ProcessMessages;

[bobafett] BobbaFet [bobafett]

Everyone has a right to my opinion.
[/b]
Great Delphi Websites faq102-5352
 
Hi.
Personally, I would use a TThread to manage this operation.

Then, you don't have to use ProcessMessages at all and the GUI remains updated at all the time. Even if the appliation is 100% busy with the fileoperation.


KungTure-RX.jpg

//Nordlund
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top