I have an app with a main TForm A sometimes calling a modal TForm B or
a simple MessageBox. On the same TForm A I have a timer. I would
like this timer to check if the app is waiting for a modalResult of
either TForm B / MessageBox.
Something like :
procedure TForm1.Timer1Timer(Sender: TObject);
begin
// Of course, modalWindowActive doesn't exists, but you get the
idea...
if TApplication.modalWindowActive then Edit1.Text := 'App is busy
waiting for user...'
else Edit1.Text := 'App is not
busy...';
end;
Anyone?
With the API returned handle , you can then use that to query
information about the window to ID it. Like the GetWindowText
for example...
Of course, if you have these windows pre initiated in the
background, you could always check the ACTIVE property.
You're in control of both the forms, right? Especially form A, right?
So, before you show the modal form, make a note that you're showing it.
You could do that by setting a Boolean variable, for instance. When the
modal window closes, note that, too.
Now, when you have code that wants to know whether some other code has
done something, it can check.
--
Rob
if Screen.ActiveForm <> Application.MainForm then
// There is an opened Window which is not the MainForm