Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Microsoft: FoxPro FAQ

API Functions

How long the system is running since last boot by AirCon
Posted: 6 Nov 03 (Edited 8 Nov 03)

This function will determine how long the system has been running since the last time we start up (boot) the system.

Notes: the return value is DWORD (32bit unsigned long). So it will wrap around (reset) to zero if the system run continuously for 49.7 days.


*** Example
#Define CR   chr(13)

Local lcOldEscape
Local lnDays, lnHours, lnMinutes, lnSeconds

lcOldEscape = set('escape')
Set escape off
Set decimals to 3
Do while (lastkey() != 27)
    GetSystemElapsedTime(@lnDays, @lnHours, @lnMinutes, @lnSeconds)
    Wait 'Windows has been running for: ' + CR + CR + ;
        alltrim(transform(lnDays, '99 days')) + CR + ;
        alltrim(transform(lnHours, '99 hours')) + ', ' + ;
        alltrim(transform(lnMinutes, '99 minutes')) + ', ' + ;
        alltrim(transform(lnSeconds, '99.999 seconds')) + CR + CR + ;
        'Press ESC to close...' window nowait noclear
    = inkey(0.1, 'HM')
Set decimals to
Set escape &lcOldEscape
Wait clear
** Clear Dlls GetTickCount

*** The function
Procedure GetSystemElapsedTime(tnDays, tnHours, tnMinutes, tnSeconds)
    Local lnTick

    Declare Long GetTickCount in Kernel32

    lnTick = GetTickCount()
    tnHours = int(lnTick / 3600000)
    If (tnHours > 23)
        tnDays = int(tnHours/24)
        tnHours = mod(tnHours, 24)
        tnDays = 0
    lnTick = mod(lnTick, 3600000)
    tnMinutes = int(lnTick / 60000)
    tnSeconds = Mod(lnTick, 60000) / 1000
*** End function

Back to Microsoft: FoxPro FAQ Index
Back to Microsoft: FoxPro Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close