Ver Mensaje Individual
  #2 (permalink)  
Antiguo 02/04/2008, 12:52
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
Re: Tiempo encendido PC

Hola,con el api GetTickCount podes saber el tiempo que esta encendida:

Código:
Private Declare Function GetTickCount Lib "kernel32" () As Long

Private Sub Form_Load()
MsgBox getTimePassed
End Sub

Public Function getTimePassed() As String
Dim lngHour As Long
Dim lngMinute As Long
Dim lngSeconds As Long
lngHour = Int(GetTickCount / 1000 / 60 / 60)
lngMinute = Int((GetTickCount / 1000 / 60)) - lngHour * 60
lngSeconds = Int((GetTickCount / 1000)) - lngMinute * 60 - lngHour * 3600
getTimePassed = Trim(Str(lngHour) & ":" & sGetWideTimeString(lngMinute) & ":" & sGetWideTimeString(lngSeconds)) & vbNullChar
End Function

Public Function sGetWideTimeString(ByVal btInputNumb As Byte) As String
Dim sTemp As String
sTemp = Trim(Str(btInputNumb))
If Len(sTemp) = 1 Then sTemp = "0" & sTemp
sGetWideTimeString = sTemp
End Function
saludos.
__________________
" Todos Somos Ignorantes; lo que pasa es que no todos ignoramos las mismas cosas " - Albert Einstein