First commit 18/07/2000
This commit is contained in:
56
Apagar.cpp
Normal file
56
Apagar.cpp
Normal file
@ -0,0 +1,56 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vcl.h>
|
||||
#pragma hdrstop
|
||||
|
||||
#include "Apagar.h"
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma package(smart_init)
|
||||
#pragma resource "*.dfm"
|
||||
TForm1 *Form1;
|
||||
//---------------------------------------------------------------------------
|
||||
__fastcall TForm1::TForm1(TComponent* Owner)
|
||||
: TForm(Owner)
|
||||
{
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TForm1::Timer1Timer(TObject *Sender)
|
||||
{
|
||||
if ( CheckBox1->Checked )
|
||||
{
|
||||
TDateTime hm = TDateTime::CurrentTime();
|
||||
unsigned short h, m, s, ss;
|
||||
hm.DecodeTime( &h, &m, &s, &ss );
|
||||
if ( h == Edit1->Text.ToInt() && m >= Edit2->Text.ToInt() )
|
||||
{
|
||||
|
||||
if (!ExitWindowsEx(EWX_SHUTDOWN | EWX_FORCE | EWX_POWEROFF, 0))
|
||||
{
|
||||
ShowMessage( "Error Cerrando el EQUIPO\nIntente cierre manual" );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TForm1::Edit2Change(TObject *Sender)
|
||||
{
|
||||
try {
|
||||
if ( Edit2->Text.ToInt() < 0 || Edit2->Text.ToInt() >59 ) Edit2->Text = "0";
|
||||
} catch(...) { Edit2->Text = "0";
|
||||
Edit2->SelStart= 0;
|
||||
Edit2->SelLength= 1;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TForm1::Edit1Change(TObject *Sender)
|
||||
{
|
||||
try {
|
||||
if ( Edit1->Text.ToInt() < 0 || Edit1->Text.ToInt() > 23 ) Edit1->Text = "0";
|
||||
} catch(...) { Edit1->Text = "0";
|
||||
Edit1->SelStart= 0;
|
||||
Edit1->SelLength= 1;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
Reference in New Issue
Block a user