Ver Mensaje Individual
  #1  
Antiguo 27-01-2006
Avatar de Enan0
Enan0 Enan0 is offline
Miembro
 
Registrado: may 2004
Ubicación: Argentina
Posts: 565
Reputación: 23
Enan0 Va por buen camino
method WndProc not found in ....

Hola amigos, Bueno estoy teniendo este problemita con un servicio de windows., se que no es lo mas correcto visualizar formularios con un servicio, pero así me lo han requerido..
Buscando en el foro como hacer para detectar la creación de la barra de tareas. encontre el codigo que debajo uso
"procedure WndProc(var Msg: TMessage); override"

pero al momento de compilar me salta el siguiente error y no se porque. alguna idea??

method WndProc not found in Base class

Código Delphi [-]
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, SvcMgr, Dialogs,
  ExtCtrls,Forms,Newscsnycit;

type
  TXCnSrv = class(TService)
    Timer1: TTimer;
    procedure ServiceExecute(Sender: TService);
    procedure Timer1Timer(Sender: TObject);
    procedure ServiceCreate(Sender: TObject);
    procedure ServiceStop(Sender: TService; var Stopped: Boolean);
  private
    { Private declarations }
  public
    function GetServiceController: TServiceController; override;
    { Public declarations }
  Protected
    procedure WndProc(var Msg: TMessage); override;
end;

var
  XCnSrv: TXCnSrv;
  CMTaskBarCreated:Cardinal;
  fmX:TfmX;
implementation
uses auditoria;
{$R *.DFM}

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

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

procedure TXCnSrv.ServiceExecute(Sender: TService);

begin
  While not terminated do
    ServiceThread.ProcessRequests(True);

end;

procedure TXCnSrv.Timer1Timer(Sender: TObject);
begin
  try
    EscribirAuditoria('ingreso en el Timer');
    fmX:= tfmX.Create(nil);
    EscribirAuditoria('Creo el formulario');
    fmX.Show;
    fmX.Hide;
    EscribirAuditoria('visualizo el form');
  finally
    Timer1.Enabled:=false;
    EscribirAuditoria('Desabilito el timer');
  end;
  EscribirAuditoria('Salio del Timer');
end;

procedure TXCnSrv.ServiceCreate(Sender: TObject);
begin
  EscribirAuditoria('*-*=**-*=**-*=**-*=**-*=**-*=**-*=*');
  EscribirAuditoria('Creando el servicio');
  Timer1.Enabled:=false;
  Timer1.Interval:=60000;//espera a que exchange & SQLsr. esten listos
  Timer1.Enabled:=true;
  EscribirAuditoria('Servicio Creado');
  EscribirAuditoria('*-*=**-*=**-*=**-*=**-*=**-*=**-*=*');
end;

procedure TXCnSrv.ServiceStop(Sender: TService; var Stopped: Boolean);
begin
  EscribirAuditoria('Servicio detenido');
  Stopped :=true;
end;
//Detecta la Creación de la barra de tareas
procedure TXCnSrv.WndProc(var Msg: TMessage);
begin
  inherited;
if (Msg.Msg = CMTaskbarCreated) and (not CredTsk)  then
  begin
    //Procedimiento que crea el Icono en SysTray....
    fmX.MostrarForm;
  end;
end;

end.
Responder Con Cita