your windows is running 13 minutes!

vb6 Somalia
  • 14 years ago

    Hi guys

    This code will show you how much time your windows is running

    'Inser this code into the module

    Declare Function GetTickCount Lib "kernel32" () As Long

    'Insert this code to your form:

    Private Sub Form_Load()
    MsgBox GetTickCount()
    End Sub

    Remember it shows the time in milliseconds so to get in seconds devide it by 1000

    regards

    DoctorMahdiBig Smile [:D]

  • 14 years ago

    Hi DoctorMahdi

    thanks for the good tip

    regards

    VBlover

  • 14 years ago

    I broke your time up into Days, Hours, Minutes, and Seconds.


    Private Declare Function GetTickCount Lib "kernel32" () As Long
    Option Explicit

    Private Sub Form_Load()
        Dim lnUptime As Long
        Dim intDays As Integer
        Dim intHours As Integer
        Dim intMinutes As Integer
        Dim intSeconds As Integer
       
        lnUptime = GetTickCount()
       
        intSeconds = (lnUptime / 1000) Mod 60
        intMinutes = (lnUptime / 1000 / 60) Mod 60
        intHours = (lnUptime / 1000 / 60 / 60) Mod 24
        intDays = Floor(lnUptime / 1000 / 60 / 60 / 24)
       
        MsgBox ("The total uptime for this machine is:" & vbCrLf & intDays & " Days" & vbTab & vbTab & intHours & " hours" & vbCrLf & intMinutes & " Minutes" & vbTab & intSeconds & " Seconds!")

    End Sub

























Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“If Java had true garbage collection, most programs would delete themselves upon execution.” - Robert Sewell