Find Code:
All Words
Any of the Words
Exact Phrase
Home
:
Code
:
Forums
:
Submit
:
Mailing List
:
About
:
Contact
Code
All
VB.NET
ASP.NET
C#
VB Classic
ASP Classic
Snippets
Popular
Resources
Submit Code
Forums
Articles
Tips
Links
Books
Contest
Link to us
Uses GetTickCount to find out how long the PC has ...
Author:
Andy Southcombe
E-mail:
Click to e-mail author
Submitted:
10/19/2002
Version:
VB6
Compatibility:
VB6
Category:
Date/Time
Views:
16171
Uses GetTickCount to find out how long the PC has been up for.
Declarations:
Public Declare Function GetTickCount Lib "kernel32" () As Long
Code:
Public Function fnUpTime() As String Dim strUpTime As String Dim intInitialLen As Integer Dim intNewLen As Integer Dim lngSeconds As Long Dim lngMinutes As Long Dim intMinutes As Integer Dim intHours As Integer Dim intDays As Integer strUpTime = GetTickCount intInitialLen = (Len(strUpTime)) intNewLen = (intInitialLen - 3) lngSeconds = Left(strUpTime, intNewLen) lngMinutes = (lngSeconds \ 60) intHours = (lngMinutes \ 60) If lngSeconds <= 3600 Then intMinutes = (lngSeconds \ 60) ElseIf lngSeconds > 3600 And lngSeconds < 86400 Then intHours = (lngSeconds \ 3600) intMinutes = (lngMinutes - (intHours * 60)) ElseIf lngSeconds >= 86400 Then intDays = (lngSeconds \ 86400) intHours = (intHours - (intDays * 24)) intMinutes = (lngMinutes - (intDays * 1440) - (intHours * 60)) End If fnUpTime = intDays & " Day(s), " & intHours & " Hour(s) and " & intMinutes & " Minutes" End Function
Home
|
Forums
|
Submit
|
Books
|
Mailing List
|
Advertising
|
About
|
Contact
© 2024 A1VBCode. All rights reserved.
Legal disclaimer & terms of use
Privacy statement