Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Otros entornos y lenguajes > .NET
Registrarse FAQ Miembros Calendario Guía de estilo Buscar Temas de Hoy Marcar Foros Como Leídos

 
 
Herramientas Buscar en Tema Desplegado
  #5  
Antiguo 21-01-2008
Kastor Kastor is offline
Registrado
 
Registrado: jun 2007
Posts: 6
Poder: 0
Kastor Va por buen camino
Unhappy

me he complicado demasiado al parecer.

busque todo lo referente al SetTimer y temporizadores, pero nada me resulta con buen termino.

para empezar la funcion tiene STDCALL, pero me envia un error de:
"Procedure definition must be ILCODE calling convention"

probe con {$UNSAFECODE ON}, pero solo funciono en la declaracion de la funcion.

esto es lo que he implementado:

Código Delphi [-]
procedure TWindowsService.TimerProc( wnd : HWND;  msg : UINT; iTimerID : UINT; dwTime : DWORD );
begin

//TimerAction;

try
    archivo.Add('TimerAction');
    archivo.SaveToFile('C:\un_texto.txt');
except
  on e: exception do begin
    archivo.Add(e.ToString);
  archivo.SaveToFile('c:\un_texto_Error.txt');

  end;
end;
end;


en el evento Onstart
Código Delphi [-]
procedure TWindowsService.OnStart(args: array of string);

begin
  inherited;
  try
    SetTimer(NULL,0,3000, @timerproc );
  except
    on e: exception do begin
      archivo.Add(e.ToString);
      archivo.SaveToFile('c:\error.txt');
    end;
  end;
end;

para poder usar la variable NULL es necesario agregar unit "variants"

me da el siguiente error:
"Borland.Vcl.EVariantTypeCastError: Invalid variant type conversion of Null variant into LongWord
at Borland.Vcl.VariantHelper.VarTypeCastError(Int32 ASourceType, Int32 ADestType)
at Borland.Vcl.VariantHelper.HandleExceptionTranslation(Exception E, Int32 AFirstType, Int32 ASecondType)
at Borland.Vcl.VariantHelper.UnhandledConversionException(Exception E, Int32 OldType, Int32 NewType)
at Borland.Vcl.VariantHelper.ToUInt32(Object AObject)
at Service.TWindowsService.OnStart(String[] args)
"

este link tambien lo revise
http://www.clubdelphi.com/foros/showthread.php?t=44155
(que ademas tiene unas frases para el Oscar, que me rei mucho )



la ultima pregunta es, en que lugar debo llamar a KillTimer, creo que al evento:
OnStop, OnPause, OnShutDown ???

gracias camaradas.
Responder Con Cita
 


Herramientas Buscar en Tema
Buscar en Tema:

Búsqueda Avanzada
Desplegado

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
Como arrancar o parara un servicio en funcion de otro servicio ?? QuarkBcn API de Windows 12 15-06-2011 14:46:11
Instalacion Firebird en D2005 cesarsoftware Conexión con bases de datos 1 27-11-2006 21:24:44
ORD? diferente resultado en D7 k en D2005????? arantzal Varios 0 24-06-2005 09:39:17
Aplicaciones MDI en D2005 y .NET adcoma .NET 2 13-04-2005 16:39:51
Ayuda de D2005 bpesoj Varios 0 25-12-2004 11:41:42


La franja horaria es GMT +2. Ahora son las 20:00:45.


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