Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Varios
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Grupo de Teaming del ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 15-05-2013
yevabas yevabas is offline
Miembro
NULL
 
Registrado: nov 2010
Posts: 42
Poder: 0
yevabas Va por buen camino
Aplicación queda siempre activa

Buenas tardes

tengo una aplicación que queda activa en el administrador de tareas y no cierra después de darle el "close", por favor si alguien me puede ayudar le agradezco mucho por su colaboración y tiempo ya que lo que había en los foros no me sirvió ninguno, o mas bien no supe interpretarlo para saber que hacer muchas gracias de nuevo.

este es mi código para el form principal.

Código Delphi [-]

unit pantalla;



interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, JvExControls, JvgDigits, StdCtrls, CPort, JvComponentBase, JvTFManager, JvTFAlarm;

type
  TForm1 = class(TForm)
    ComPort1: TComPort;
  
    procedure FormCreate(Sender: TObject);
    procedure ComPort1RxChar(Sender: TObject; Count: Integer);
    procedure validar();



  private
    { Private declarations }
  public
     StartX, StartY, StartW, StartH,s1,h1: Integer;
     flat : Boolean;
    { Public declarations }
  end;

var
  Form1: TForm1;
  a,h,m,s,b: Integer;
  var dato1,dato3,t,t1: string;

implementation



{$R *.dfm}

uses reloj;

procedure TForm1.FormCreate(Sender: TObject);
begin
  ComPort1.ShowSetupDialog;

  a:= 0;
  b:= 0;
  ComPort1.Open;
  SwitchDesktop(CreateDesktop('ClubDelphi', nil, nil, 0, MAXIMUM_ALLOWED, nil));

  BoundsRect := Rect(0, 0, 0, 0);
end;

procedure TForm1.ComPort1RxChar(Sender: TObject; Count: Integer);

begin
 ComPort1.ReadStr(dato1, Count);
 dato3 := dato3+dato1;
 if Length(dato3) = 8 then
    validar();
end;

procedure TForm1.validar();
begin
  h1:=0;
  t:= Copy(dato3,1,1);
  if t = 'I' then
   begin
     t1:= Copy(dato3,3,3);
     s1:=StrToInt(t1)+ reloj.mm;
     if s1 > 59 then
       begin
         while s1 > 59 do
           begin
             s1:= s1-60;
             Inc(h1);
           end;
       end;

     SwitchDesktop(OpenDesktop('Default', 0, False, DESKTOP_SWITCHDESKTOP));


    with TClock.Create(Self) do
       SetWindowPos(Handle, // handle to window
               HWND_TOPMOST, // placement-order handle {*}
               1,  // horizontal position
               739,   // vertical position
               60,
               20,
               // window-positioning options
               SWP_NOREPOSITION);

   end
  else
    if t= 'C' then
      begin
         ComPort1.WriteStr('CERRANDO');
         SwitchDesktop(OpenDesktop('Default', 0, False, DESKTOP_SWITCHDESKTOP));
         ComPort1.Close;
         Close;
      end;


   dato3 := '';
   dato1 := '';

end;

end.


y el form2 es el siguiente;

Código Delphi [-]

unit reloj;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, JvExControls, JvSegmentedLEDDisplay, ExtCtrls, StdCtrls;

type
  TClock = class(TForm)
    
    Timer1: TTimer;
    procedure FormCreate(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
  private
    { Private declarations }
  public
    flat: Boolean;
    { Public declarations }

  end;

var
  Clock: TClock;
  ss,mm,hh,t: Integer;
  s,m,h: string;

implementation

uses pantalla;

{$R *.dfm}

procedure TClock.FormCreate(Sender: TObject);
begin
   flat := False;
   ss:= 59;
   mm:= Form1.s1;
   hh:= Form1.h1+hh;
   t:=0;

   if mm > 59 then
       begin
         while mm > 59 do
           begin
             mm:= mm-60;
             Inc(hh);
           end;
       end;

    
end;



procedure TClock.Timer1Timer(Sender: TObject);
begin
    if mm = 0 then
      begin
        if hh > 0 then
          begin
            Dec(hh);
            mm:=59;
            ss:=60;
          end
        else
          if ss = 0 then
            begin
    
              Form1.ComPort1.WriteStr('I1');
              SwitchDesktop(CreateDesktop('ClubDelphi', nil, nil, 0, MAXIMUM_ALLOWED, nil));
              Clock.Close;
            end;

      end;

      if t=60 then
       begin
        if mm > 0 then
         begin
          Dec(mm);
          ss:=60;
          t:=0;
         end;
         t:=0;
       end;

     inc(t);
     Dec(ss);
    

end;

end.

los datos por el puerto los acepta bien pero cuando intento cerrar, queda la aplicación activa en el administrador de tareas no se cierra definitivamente,


de nuevo mucas gracias
Responder Con Cita
 



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Aplicación se queda congelada !!!! david_uh Varios 2 20-10-2012 03:08:23
aplicacion activa armando API de Windows 2 27-12-2011 22:32:49
Aplicacion activa dao_ar OOP 4 15-08-2011 03:57:06
Convertir Aplicacion en Activa bohemioloco API de Windows 3 25-04-2007 22:25:29
Conocer el nombre de la aplicacion que se encuentra activa cso2000 Varios 4 24-10-2003 02:28:14


La franja horaria es GMT +2. Ahora son las 20:25:51.


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
Copyright 1996-2007 Club Delphi