Board index » delphi » HELP: Giving Time to other applications.

HELP: Giving Time to other applications.

Hi all,

I have an application that does FTP. When I login to a
host, I change the screen.cursor to crHourGlass.

After the login this screen.cursor is changed back to normal. It
is this event that i want to trigger BUT

if I use this line :

while screen.cursor=crHourglass do ;  {wait if cursor-hourglass}

Windows keeps waiting and spends 100% of his time waiting. So
that the login proces in the background doesn't get time to complete.

Consequence : infinite loop !!!

My Question is : How Can I wait in my program, without stopping the
background processes ???

Geert.

 

Re:HELP: Giving Time to other applications.


Quote
Geert Nijs <Geert.N...@fys.kuleuven.ac.be> wrote:
>Hi all,

>I have an application that does FTP. When I login to a
>host, I change the screen.cursor to crHourGlass.

>After the login this screen.cursor is changed back to normal. It
>is this event that i want to trigger BUT

>if I use this line :

>while screen.cursor=crHourglass do ;  {wait if cursor-hourglass}

>Windows keeps waiting and spends 100% of his time waiting. So
>that the login proces in the background doesn't get time to complete.

>Consequence : infinite loop !!!

>My Question is : How Can I wait in my program, without stopping the
>background processes ???

>Geert.

Maybe in using a timer. You set the 'Interval' property to 1 sec or so, and
code the 'OnTimer' event to check if the cursor is still the hour glass or not.
And if that's the case then disable the timer and do your stuff.

        Alan.

--
Alan GARNY                              http://www.physiol.ox.ac.uk/~gry
University Laboratory of Physiology       Job Phone: +44 (0)1865 272-501
Parks Road                                 Job  Fax: +44 (0)1865 272-554
Oxford, OX1-3PT, UK                      Home Phone: +44 (0)1865 370-240

Re:HELP: Giving Time to other applications.


Quote
Geert Nijs wrote:

> Hi all,

> I have an application that does FTP. When I login to a
> host, I change the screen.cursor to crHourGlass.

> After the login this screen.cursor is changed back to normal. It
> is this event that i want to trigger BUT

> if I use this line :

> while screen.cursor=crHourglass do ;  {wait if cursor-hourglass}

> Windows keeps waiting and spends 100% of his time waiting. So
> that the login proces in the background doesn't get time to complete.

> Consequence : infinite loop !!!

> My Question is : How Can I wait in my program, without stopping the
> background processes ???

> Geert.

Try putting the following statement in your Do loop

Application.ProcessMessages;

This should do the trick-use it whenever you have a tight loop and need
to let windows messages process,

-Anthony

Re:HELP: Giving Time to other applications.


In article <31E6F326.1...@fys.kuleuven.ac.be>, Geert.N...@fys.kuleuven.ac.be
says...

Quote
>if I use this line :

>while screen.cursor=crHourglass do ;  {wait if cursor-hourglass}

>Windows keeps waiting and spends 100% of his time waiting. So
>that the login proces in the background doesn't get time to complete.

>Consequence : infinite loop !!!

>My Question is : How Can I wait in my program, without stopping the
>background processes ???

>Geert.

Hi,

The command

Application.ProcessMessages;

will allow your Delphi application to process any Windows activity that may
need attention i.e. and other application funtions.

Hope this helps.

Glen O'Dwyer

Other Threads