Otra Opción sería crear un servicio / programa oculto que le notifiquen cuando el usuario cambie la hora del sistema. Muestras un mensaje en pantalla y si tu programa está funcionando, puedes sacar un mensaje en pantalla poniendo verde al usuario
.
Código Delphi
[-]
Unit UTimeChange;
interface
Uses
Classes, Windows, Messages, Forms;
Type
TTimeChange = class(TComponent)
private
FWindowHandle: HWND;
FOnTimeChange: TNotifyEvent;
FEnabled: Boolean;
procedure WndProc(var Msg: TMessage);
protected
procedure TimeChange; dynamic;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
published
property Enabled: Boolean read FEnabled write FEnabled default True;
property OnTimeChange: TNotifyEvent read FOnTimeChange write FOnTimeChange;
end;
implementation
constructor TTimeChange.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FEnabled := True;
FWindowHandle := Classes.AllocateHWnd(WndProc);
end;
destructor TTimeChange.Destroy;
begin
FEnabled := False;
Classes.DeallocateHWnd(FWindowHandle);
inherited Destroy;
end;
procedure TTimeChange.WndProc(var Msg: TMessage);
begin
with Msg do Begin
if FEnabled and (Msg = WM_TIMECHANGE) then
try
TimeChange;
except
Application.HandleException(Self);
end
else
Result := DefWindowProc(FWindowHandle, Msg, wParam, lParam);
End;
end;
procedure TTimeChange.TimeChange;
begin
if Assigned(FOnTimeChange) then FOnTimeChange(Self);
end;
end.
No he mirado si tambien lo detecta en el DOS, además podría reiniciar la máquina entrar en modo DOS y cambiar la fecha, pero bueno, esos temas se han tratado anteriormente.
Edito: He puesto con comentarios el procedure Register, ya que no me gusta tenerlo en la paleta de componentes de Delphi, sino tenerlo en el Library Path y crearlo por código como si fuera un objeto más. Si quieres tenerlo en la paleta, pues quita los comentarios de dicho procedure.
Aunque el código es antiguo, no disponía de él cuando se originó este hilo.
Saludos y suerte.