Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Varios (https://www.clubdelphi.com/foros/forumdisplay.php?f=11)
-   -   Violacion De Acceso (https://www.clubdelphi.com/foros/showthread.php?t=26221)

elguille 17-10-2005 16:10:02

Violacion De Acceso
 
PORQUE EL SIGUIENTE CODIGO NO DA ERROR

Código Delphi [-]
  PROCEDURE impform;
  var I:INTEGER;
      miform:tform;
  BEGIN
  I:=0;
  WHILE i <= Screen.FormCount - 1 do BEGIN
    MIFORM:=TFORM(Screen.Forms[i]);
      if MIFORM.Active then begin
          MIFORM.PrintScale:=poprinttofit;
          MIFORM.Print;
          I:=Screen.FormCount;
      end else
        i:=i+1;
  end;
  END;

Y ESTE DA ERROR VIOLACION DE ACCESO ¿¿¿ ???

Código Delphi [-]
  PROCEDURE impform;
  var I:INTEGER;
  BEGIN
  I:=0;
  WHILE i <= Screen.FormCount - 1 do BEGIN
      if TFORM(Screen.Forms[i]).Active then begin
          TFORM(Screen.Forms[i]).PrintScale:=poprinttofit;
          TFORM(Screen.Forms[i]).Print;
          I:=Screen.FormCount;
      end else
        i:=i+1;
  end;
  END;

Neftali [Germán.Estévez] 17-10-2005 16:23:00

Hola y bienvenido (puesto que es tu primer mensaje);
Si deseas que tu código se lea mejor utiliza TAG's (/en éste caso ya te los pongo yo):
http://www.clubdelphi.com/foros/showthread.php?t=9992

Te recomiento también que leas la guía de estilo:
http://www.clubdelphi.com/foros/guiaestilo.php
En especial éste punto:
http://www.clubdelphi.com/foros/guiaestilo.php

Yo no le veo ningun problema a priori.
¿Has probado a ejecutarlo paso a paso?
¿En qué línea da el error?

elguille 17-10-2005 16:32:56

Si y el error lo da en

TFORM(Screen.Forms[i]).Print;



Gracias por la bienvenida, prometo leer el manual enseguida que pueda.


La franja horaria es GMT +2. Ahora son las 04:43:56.

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