Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

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

Coloboración Paypal con ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #2  
Antiguo 29-04-2005
Avatar de hermes_32
hermes_32 hermes_32 is offline
Miembro
 
Registrado: jul 2003
Posts: 94
Poder: 23
hermes_32 Va por buen camino
Para que tu aplicacion sea un servicio inicia un nuevo proyecto asi:

File -> New -> Other -> Service Application

Este será el aspecto:

Código Delphi [-]
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, SvcMgr, Dialogs;

type
  TService1 = class(TService)
  private
    { Private declarations }
  public
    function GetServiceController: TServiceController; override;
    { Public declarations }
  end;

var
  Service1: TService1;

implementation

{$R *.DFM}

procedure ServiceController(CtrlCode: DWord); stdcall;
begin
  Service1.Controller(CtrlCode);
end;

function TService1.GetServiceController: TServiceController;
begin
  Result := ServiceController;
end;

end.

Ahora tienes que implementar tú los métodos:

Código Delphi [-]
    procedure ServiceStart(Sender: TService; var Started: Boolean);
    procedure ServiceStop(Sender: TService; var Stopped: Boolean);

Me imagino que querrás que realice cada cierto tiempo una acción. Pues no puedes poner un Timer así por las buenas. Debes crearlo:

Código Delphi [-]
  .
  .
  .
    private
      { Private declarations }
      Timer: TTimer; 
  .
  .
  .

Y al comenzar el servicio:

Código Delphi [-]
    procedure ServiceStart(Sender: TService; var Started: Boolean);
    begin
      Timer:=TTimer.Create(nil);
      Timer.Interval := Intervalo;
      Timer.OnTimer:=TimerOnTimer; //aquí la acción 
    end;

Y al terminar el servicio:

Código Delphi [-]
    procedure ServiceStop(Sender: TService; var Stopped: Boolean);
    begin
     Timer.Free;
     Timer:=nil;      
    end;

Bueno esto es mas o menos el trabajo. Espero que te ayude.
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


La franja horaria es GMT +2. Ahora son las 15:16:30.


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