function isModal(Form: TForm): byte;
begin
if Assigned(Form) and Form.visible then begin
Result := ord(fsModal in Form.FormState);
end else Result := 2;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
case isModal(Form2) of
0: Form2.Label1.caption := 'nicht modal';
1: Form2.Label1.caption := 'modal';
2: Showmessage('Form2 nicht gefunden');
end;
end;