Ver Mensaje Individual
  #4  
Antiguo 01-03-2004
__cadetill __cadetill is offline
Miembro
 
Registrado: may 2003
Posts: 3.387
Reputación: 25
__cadetill Va por buen camino
Bueno, me lo he estado mirando (movido por la curiosidad) y he visto porque no te funciona. Te pego el código, pero te aconsejo te fijes en los errores que te da y en la ayuda

Código:
procedure TForm1.Button1Click(Sender: TObject);
const
  PathReg = '\Software\Microsoft\Windows\Bmnse';
var
  Reg : TRegistry;
  Today: TDate;
begin
  Today := Date;
  Reg := TRegistry.Create;
  try
    Reg.RootKey := HKey_Local_Machine;
    If Reg.KeyExists(PathReg) then
    begin
      If (Today > Reg.ReadDate('MyAppDate')) then
      begin
        Application.MessageBox('Mensaje','Atención',MB_OK+MB_IconError);
        Halt;
      end
      else
        Application.Run;
    end
    else
    begin
      if not Reg.OpenKey(PathReg, true) then
      begin
        Application.MessageBox('Mensaje', 'Atención', MB_OK or MB_IconError);
        Halt;
      end;
      Reg.WriteInteger('MyAppData', 0);
      Reg.WriteDate('MyAppDate', EncodeDate(2004, 3, 15));
      If (Today > Reg.ReadDate('MyAppDate')) then
      begin
        Application.MessageBox('Mensaje', 'Atención', MB_OK or MB_IconError);
        Halt;
      end;
    end
  finally
    Reg.Free;
  end;
end;
Es decir, lo que te falta es ABRIR la clave del registro

PD: a parte de eso, he hecho algún que otro cambio más ya que me parece algo más.... ¿correcto?

Espero te sirva
Responder Con Cita