Shoutbox

Visual Basics : Uptime - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Forum: Plug-Ins (/forumdisplay.php?fid=28)
+------ Thread: Visual Basics : Uptime (/showthread.php?tid=27614)

Visual Basics : Uptime by dotNorma on 06-23-2004 at 09:13 PM

Anybody know how to get system uptime in Visual Basics?

I searched google but the only things that looked useful were like in German or Dutch. And I couldn't understand them.

NoName: http://www.vb-magazin.de/new/postt682.html
See anything useful about getting uptime there , I cant understand :p
TheBlasphemer: It's german bitch -_-
TheBlasphemer: NEVER EVER compare dutch and german :P
NoName : How do I know , All looks the same
TheBlasphemer: That' insuling

:lol:


RE: Visual Basics : Uptime by Choli on 06-23-2004 at 09:34 PM

quote:
Originally posted by NoName
Anybody know how to get system uptime in Visual Basics?
use the GetTickCount API

RE: Visual Basics : Uptime by dotNorma on 06-23-2004 at 09:46 PM

Thanks =)


RE: Visual Basics : Uptime by Mnjul on 06-24-2004 at 01:06 AM

Well Alec, I am willing to share this with you :P

Something I wrote quite a few months ago :)


RE: Visual Basics : Uptime by Sk3tch on 06-24-2004 at 02:49 AM

this is what i used for my system info plug:

code:
Private Declare Function GetTickCount& Lib "kernel32" ()

Private Function WinUpTime()
    Dim Secs, Mins, Hours, Days
    Dim TotalMins, TotalHours, TotalSecs, TempSecs
    Dim CaptionText
    TotalSecs = Int(GetTickCount / 1000)
    Days = Int(((TotalSecs / 60) / 60) / 24)
    TempSecs = Int(Days * 86400)
    TotalSecs = TotalSecs - TempSecs
    TotalHours = Int((TotalSecs / 60) / 60)
    TempSecs = Int(TotalHours * 3600)
    TotalSecs = TotalSecs - TempSecs
    TotalMins = Int(TotalSecs / 60)
    TempSecs = Int(TotalMins * 60)
    TotalSecs = (TotalSecs - TempSecs)


    If TotalHours > 23 Then
        Hours = (TotalHours - 23)
    Else
        Hours = TotalHours
    End If


    If TotalMins > 59 Then
        Mins = (TotalMins - (Hours * 60))
    Else
        Mins = TotalMins
    End If
   
    If Hours = 0 Then
        CaptionText = Mins & " Minutes, " & TotalSecs & " seconds" & vbCrLf
    ElseIf Days = 0 Then
        CaptionText = Hours & " Hours, " & Mins & " Minutes, " & TotalSecs & " seconds" & vbCrLf
    Else
        CaptionText = Days & " Days, " & Hours & " Hours, " & Mins & " Minutes, " & TotalSecs & " seconds" & vbCrLf
    End If
    WinUpTime = CaptionText
End Function

not sure if will help you but :P....

should make sense :)
RE: Visual Basics : Uptime by Choli on 06-24-2004 at 09:51 AM

quote:
Originally posted by Mnjul
Attachment: UptimeTicker.zip (16.1 KB)
nice :)
quote:
Originally posted by Sk3tch
TotalSecs = Int(GetTickCount / 1000)
    Days = Int(((TotalSecs / 60) / 60) / 24)
    TempSecs = Int(Days * 86400)
    TotalSecs = TotalSecs - TempSecs
    TotalHours = Int((TotalSecs / 60) / 60)
    TempSecs = Int(TotalHours * 3600)
    TotalSecs = TotalSecs - TempSecs
    TotalMins = Int(TotalSecs / 60)
    TempSecs = Int(TotalMins * 60)
    TotalSecs = (TotalSecs - TempSecs)


etc....



:O very complex code, isn't it? :P

what about this:
code:
Dim msecs As Long
Dim secs As Long
Dim mins As Long
Dim hours As Long
Dim days As Long
Dim total As Long
total = GetTickCount()

msecs = total Mod 1000
total = total / 1000

secs = total Mod 60
total = total / 60

mins = total Mod 60
total = total / 60

hours = total Mod 24
total = total / 24

days = total


'etc....


RE: RE: Visual Basics : Uptime by Salem on 06-25-2004 at 03:43 PM

quote:
Originally posted by Mnjul
Well Alec, I am willing to share this with you :P

Something I wrote quite a few months ago :)


Mnjul

I downloaded your file because i enquired on how to get a VB appliaction to test the version of Windows that is running. Unfortunately i cant get my prgram to do it. Please can you let me know how you did it?

This would be much appreciated.

RileyM
RE: Visual Basics : Uptime by dotNorma on 06-25-2004 at 04:00 PM

You dodgy people post all the source only after I figure it out :dodgy:

quote:
Originally posted by RileyM
Mnjul

I downloaded your file because i enquired on how to get a VB appliaction to test the version of Windows that is running. Unfortunately i cant get my prgram to do it. Please can you let me know how you did it?

This would be much appreciated.

RileyM
The source is in that zip , look at it. :-/