Ver Mensaje Individual
  #13  
Antiguo 06-05-2011
emii89 emii89 is offline
Miembro
 
Registrado: jul 2010
Posts: 18
Reputación: 0
emii89 Va por buen camino
Bien, está interesante... de todos modos quiero terminar el que estoy haciendo, pero evidentemente estoy fallando en algo.
Me tira un eConvertError... en la línea que voy a señalar... me ayudan a descubrir el error?.
Código:
implementation

{$R *.dfm}

Function TForm1.TransformaTiempo:Real;
Begin
  TransformaTiempo:=(StrToInt(EdHora.Text)*3600)+(StrToInt(EdMin.Text)*60)+(StrToInt(EdSeg.Text));
End;

procedure TForm1.BotApagarClick(Sender: TObject);
begin
  MemoBat.lines.add('shutdown /s /t '+FloatToStr(TransformaTiempo));
  MemoBat.lines.SaveToFile(ExtractFilePath(Application.ExeName)+'Apagar.Bat');
  WinExec(PChar(ExtractFilePath(Application.ExeName)+'Apagar.Bat'),SW_SHOWNORMAL);
  Sleep(250);
  DeleteFile(PChar('c:\apagar.bat'));
  MemoBat.lines.clear;
end;

procedure TForm1.BotCancelarClick(Sender: TObject);
begin
  MemoBat.lines.add('shutdown -a');
  MemoBat.Lines.SaveToFile('c:\apagar.bat');
  WinExec(PChar('c:\apagar.bat'),SW_SHOWNORMAL);
  Sleep(600);
  DeleteFile(PChar('c:\apagar.bat'));
  MemoBat.lines.clear;
end;

end.
Responder Con Cita