Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2007 Dec : how to know if my application is waiting
| Subject: | how to know if my application is waiting |
| Posted by: | "David Novo" (da..@xxx.denovosoftware.com) |
| Date: | 3 Dec 2007 22:42:26 |
Hello,
I have created a thread for testing my application. Basically, my
thread sends my application keystrokes and mouse-clicks with the
SendInput api. It also sends some custom messages via the PostMessage
command.
The problem is that sometimes I have to wait for my application to be
idle before sending the next mouse command. For instance, lets say I
want to click on some spot, and I know that makes a form appear. I want
to check the text of an edit field on the form....
So I do
SendInput(...mouse stuff here)
find the form by vcl name
find the control on the form
check the value
However, sometimes there is a lot of processing to set up the form. So
when I check the value, the form has not been set up yet. So the test
fails, even though it would have been fine.
This happens in various scenarios. What I need is a way for the thread
to check if the main app is still busy. That is what we do when we use
a program. We sit around until the form is loaded, then start clicking
away.
I tried trapping the application.IDle event, but that does not get
fired when a modal dialog is up. So if I wait for the idle event to
signal, it never happens when a modal dialog is up and the thread hangs.
Does anyone have a recommended practice as to how a thread can tell if
the main thread is just sitting around waiting for user input?
--