Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Trucos (https://www.clubdelphi.com/foros/forumdisplay.php?f=52)
-   -   Averiguar si existen formularios visibles en la pantalla (https://www.clubdelphi.com/foros/showthread.php?t=80425)

dec 07-06-2006 21:23:14

Averiguar si existen formularios visibles en la pantalla
 
Con esta función puede averiguarse si alguno de los formularios de nuestra aplicación se está mostrando en pantalla:

Código Delphi [-]
uses
  Forms;

function HasShowingFormsInScreen
 (alsoMainForm:boolean=false):boolean;
var
  i: integer;
begin
  Result := false;
  for i:=0 to Screen.FormCount-1 do
  begin
    if Result then
      Exit;
    if Screen.Forms[i].Showing then
    begin
      with Screen, Application do
      begin
        if (Forms[i] = MainForm) then
          Result := alsoMainForm
        else
        begin
          Result := true;
          Exit;
        end;
      end;
    end;
  end;
end;


La franja horaria es GMT +2. Ahora son las 23:31:11.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi