No se necesita ser un genio

Auto Off

14.03.2013 01:48

 

Hola amigos !

A quien no le ha pasado que , estamos descargando algo y le falta un buen rato para terminar pero ya te quieres ir a dormir, o que pones una pelicula en tu compu y te quedas dormido y esta se queda tda la noche prendida gastando luz.

Bueno pues esta aplicacion que crearemos hoy , nos ayudara con eso :)  .

Auto Off , es un timer al cual podremos ponerle en cuantos minutos quieres que se apague la computadora , y lo que es mejor , es muy sencillo de hacer.

Bueno pongamos manos a la obra.

Para empezar abriremos un nuevo proyecto exe en nuestro Visual Basic 6.0 , y añadiremos los controles que necesitaremos. Los cuales seran los siguientes:

2 Label , 1 Text box , 1 Timer , 1 Image, 1 Command Buton , 1 Frame y dentro de este 2 Command Buton.

Los valores que les daremos a nuestros controles seran los siguientes :

Form : BorderStyle = Fixed Single , Backcolor = Blanco , StartUpPosition = CenterScreen

Label  1  : Autosize = True , Caption = Este ordenador se apagara en , Font = tamaño 8 y negrita , Backcolor = blanco.

Label 2 : Autosize = True , Caption = Minutos , Font = tamaño 12 y negrita , Backcolor = blanco.

Text Box : Text = 1 , Maxlength = 4 , Font = tamaño 14 y negrita.

Timer : Interval = 1000 , Enabled = False

Frame : Backcolor = Blanco , Caption = Apagado automatico

Command buton 1 : Caption = Comenzar

Command buton 2 : Caption = Detener , Enabled = False

Command buton 3 : Caption = Ocultar

Image : Strech = True

Nota : presta atencion a que solo modificaremos el Enabled al command buton 2 (ver imagen Auto Off Controles).

Los tendremos que acomodar de tal manera que nos quede mas o menos asi :

Imagen Auto Off controles.

Ahora el codigo fuente a escribir sera el siguiente :

 

Private Sub Command1_Click()
Text1.Enabled = False
Text1.Text = Val(Text1.Text) * 60
Label2.Caption = "Segundos"
Timer1.Enabled = True
Command1.Enabled = False
Command2.Enabled = True
End Sub
 
Private Sub Command2_Click()
Timer1.Enabled = False
Text1.Text = "1"
Label2.Caption = "Minutos"
Command1.Enabled = True
Command2.Enabled = False
End Sub
 
Private Sub Command3_Click()
If MsgBox("¿Deseas ocultar esta aplicacion?", vbYesNo + vbExclamation, "Auto Off") = vbYes Then
 Form1.Hide
End If
End Sub
 
Private Sub Text1_Change()
If Text1.Enabled = True Then
 If Val(Text1.Text) = 0 Then
  Text1.Text = "1"
 End If
End If
End Sub
 
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii >= 48 And KeyAscii <= 57 Or KeyAscii = 127 Or KeyAscii = 8 Then
 Exit Sub
 Else
  KeyAscii = 0
  MsgBox "Solo se aceptan numeros"
End If
End Sub
 
Private Sub Timer1_Timer()
Text1.Text = Text1.Text - 1
If Text1.Text = "0" And Label2.Caption = "Segundos" Then
 Shell "shutdown -s -t 0"
End If
End Sub
 
 
Y listo , ahora solo lo convertimos en ejecutable  y tendremos nuestro timer para apagar la pc a la hora que queramos :) 
Espero y les haya gustado , tambien pueden ver el video en you tube de la creacion de este timer.
Recuerden darle like y suscribirse .
 
Mira mas abajo el Video en You Tube 
 
Volver

Buscar en el sitio

© 2013 Todos los derechos reservados.