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
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.