• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Try my simple program! Source code included! (all 100 lines of it :-P)

Mucman

Diamond Member
Sorry about the fact that it's not that exciting, but you can try it out if you wish. It is a program that will tell you how long the computer has been on since your last reboot. The way it works is you put the file set_timer.exe in the startup folder and put the uptime.exe file in the windows folder... this program puts a file called start.dat in c:\, anytime you wish to know how long the computer is on, just type uptime.exe at the command prompt. I have included the code in the zip but please don't yell at me for bad coding, I prefer constructive criticism 🙂

Geocities doesn't like links so you will have to copy and paste 🙁
http://www.geocities.com/smuc2112/uptime.zip
 
Not to bag on your app, but this may help simplify you app. You can do this with a simple api, not sure which one i forgot, you can just look in the WINApi.txt that comes w/ most if not all MS dev tools, also i think in vb it will tell you how long its been running just by putting the Timer statment, i may be wrong though, its been a while sence i have messed with vb that much.
 
Hehe, I thought there was something like that, but I never found it... so I just decided to figure it out on my own... Programmers just love to re-invent the wheel! 😛
 
i cant remember how many times i have done that, the most was back in the day when i used vb3 and 4, and i had no help files, lol.
 


<< Murdock2525 - Um, 109 hours? If so then I got some debugging to do 🙂 >>



I believe he is seeing how long he has been online. Win2k keeps track of how long the connection has been active, so you if you look at the properties for that NIC, then it will tell you basically how long your computer has been up, as long as you don't unplug your network card.
 
I would use the WINAPI function:
Private Declare Function GetTickCount Lib &quot;kernel32.dll&quot; () As Long
to get the ticks then parse that into a readable time.

Function UpTime()
Dim hours, isleft, mins, secs As Integer

hours = Int(GetTickCount() / 3600000)
isleft = ticks MOD 3600000
mins = Int(isleft / 60000)
isleft = isleft MOD 60000
secs = Int(isleft / 1000)
UpTime = hours &amp; &quot;:&quot; &amp; mins &amp; &quot;:&quot; &amp; secs
End Function

There are others way to do it, this is one.
 
I just tried it in Win2k... it does not report back accurately.
Supposedly, my system has been up for:

2013273695 days
37879678 hours
784 minutes
37879589 seconds




Wait.... this disproves creationism! Therefore, if my PC has been booted for over 584,311 years (and that's not including the hours, minutes, and seconds), the world has to be more than 7k-10k years old!!

😛
 
I'm surprised that no one is interested in the utilities. They do work in Win2k. FFMCobalt was talking about Mucman's code.
 
Wow, I thought this was going to die 🙂

FFMCobalt, That's what happens when set_timer.exe hasn't been executed... technicly you could use this program more as a timer for anything... maybe I should market it that way 🙂

I new there were some API methods to do this, but I was just lazy and made my own way... wait... is that laziness or stupidy? 😛

My inspiration for this masterpiece was the uptime program for Unix.

tkdkid - I'll take a look at those utils, but I am enjoying re-inventing the wheel right now 🙂



 
Back
Top