Ver Mensaje Individual
  #6 (permalink)  
Antiguo 30/07/2009, 20:58
Avatar de seba123neo
seba123neo
 
Fecha de Ingreso: febrero-2007
Ubicación: Esperanza, Santa Fe
Mensajes: 1.046
Antigüedad: 18 años, 2 meses
Puntos: 19
Respuesta: Cronometrar tiempo de encendido del computador

mira lo facil que es...

Código vb:
Ver original
  1. Option Explicit
  2.  
  3. Private Declare Function GetTickCount Lib "kernel32" () As Long
  4.  
  5. Private vTiempoActual As String
  6.  
  7. Private Sub Form_Load()
  8.    vTiempoActual = TiempoEncendidaPC
  9.    With Timer1
  10.       .Enabled = True
  11.       .Interval = 1000
  12.    End With
  13. End Sub
  14.  
  15. Private Function TiempoEncendidaPC() As String
  16.    Dim vHoras As Long, vMinutos As Long, vSegundos As Long
  17.    
  18.    vHoras = Int(GetTickCount / 1000 / 60 / 60)
  19.    vMinutos = Int((GetTickCount / 1000 / 60)) - vHoras * 60
  20.    vSegundos = Int((GetTickCount / 1000)) - vMinutos * 60 - vHoras * 3600
  21.    
  22.    TiempoEncendidaPC = Format(vHoras, "00") & ":" & Format(vMinutos, "00") & ":" & Format(vSegundos, "00")
  23. End Function
  24.  
  25. Private Sub Timer1_Timer()
  26.    Me.Caption = Format(CDate(vTiempoActual) + CDate("00:00:01"), "Hh:mm:ss")
  27.    vTiempoActual = Me.Caption
  28. End Sub

sin llamar a la funcion con el Timer...

saludos.
__________________
" Todos Somos Ignorantes; lo que pasa es que no todos ignoramos las mismas cosas " - Albert Einstein