Welcome to MSDN Blogs Sign in | Join | Help

aWorkBlogByGus

Gus Perez on C#, .NET Development and Software Testing
Uptime 2000 - Displays system's uptime transparently on your desktop

Features:
A tiny Win32 application (C++) that displays the system's up-time either in a small (transparent) window on your desktop or in a tool tip whenever you hover over the UpTime 2000 icon in the system tray.

Install Instructions:
Unzip the uptime2k.zip archive into a new directory.  Run the uptime.exe file and you should see the UpTime icon appear in the system tray immediately.  Add it to your startup folder to always have the icon in your tray.  Right-click the tray icon and set the options as you like.  To move the display around your desktop you should turn transparency off, move it to where you want it to be, and then turn transparency on once again.  You can now save your settings and every time UpTime 2000 starts up it'll use them automatically.   Once you've positioned it where you want it and set the colors appropriately, you should click the 'remember settings' option.  If you place a shortcut to the app in your startup folder, it'll start up the same way every time you restart your machine. 

Screenshot:

Download: [Executable] --- [Source]

Posted: Wednesday, March 17, 2004 11:24 PM by GusPerez
Filed under:

Comments

aBlogByGus said:

# March 18, 2004 2:32 AM

edmundo said:

evil goto! Why not break?

// Go through counter until we find the System Up Time counter
for( j=0; j < PerfObj->NumCounters; j++ )
{
// Find index 674, which is the System Up Time
if (PerfCntr->CounterNameTitleIndex == 674)
{
LONGLONG x,y,tb;
LPVOID pb = (LPVOID)((PBYTE)PtrToCntr + PerfCntr->CounterOffset);
x = *(LONGLONG*)pb;
y = (LONGLONG)PerfObj->PerfTime.QuadPart;
tb = (LONGLONG)PerfObj->PerfFreq.QuadPart;
result = (y - x)/tb;
goto exit;
}
// Get the next counter
PerfCntr = NextCounter(PerfCntr);
}

exit:
// ...
# March 18, 2004 8:04 AM

Gus Perez said:

I'm clueless as to why. I can only imagine the code was originally different and a goto made sense then. It's been a while. I've updated it now though... Thanks.
# March 18, 2004 8:15 AM

Extreme RAD from a Trading Desk said:

# March 29, 2004 3:03 AM

Ivan Matyunin said:

I love your uptime utility and it works wonderfully, but in case of suspend/hibernation it still displays time since last boot. Is there any way to have it deduct time in suspend/hibernation?
# July 13, 2004 2:31 PM

Gus Perez said:

Ivan, I'm not sure, and to be honest I'm probably not going to get to look into it any time soon. The performance counter I'm using doesn't count suspends/hibernation as a restart, so depending on how you look at it, it's doing the right thing. However, if you want to change it, feel free to try hacking it yourself as the code is available above. Thanks!
# July 13, 2004 4:41 PM

Feroz Zahid (ferozzahid@usa.com) said:

The uptime for a server would not be the time from reboot but the time for which primary LAN is enabled. Have you got a way to find that?
# August 2, 2004 2:16 AM

Peter Stathakos said:

Very cool app. I was working on a way to do this in C# when I cam across your page. I'm still going ahead with my C# version though.

Thanks!
# August 3, 2004 12:30 PM

Feroz Zahid (ferozzahid@usa.com) said:

Just to add : It works OK on Windows 2003 Server too. :)
# August 6, 2004 1:35 AM

aBlogByGus said:

Here's the current list of available applications I've written that you are free to download and use. They're currently linked over to entries on my work blog, but I'll end up hosting everything here in the near future. RightSideUp: Application...
# January 8, 2005 1:07 PM

RexMoonD said:

How about running it as a service on Win2K3Ser using instsvr? It will install, but not start, any exe switches or command-line parameters I need to know about, or is it just not feasible with the app as it is currently designed?
# June 27, 2005 4:46 PM

McoreD said:

Great App! I wished this worked under a Limited User. Something is not allowing it. I am trying to figure this out in C#. Cheers, McoreD.
# January 2, 2006 7:48 AM

LWL said:

Thanks for the app and the source! I really only needed GetUpTime() and the functions in PerfData.cpp so I could write a command-line "uptime" executable. It's unfortunate that in WinXP the only way to do this natively is to run

> systeminfo | find "Up Time"

but that takes time since 'systeminfo' collects a lot more info. I hope they use this in Vista. ;)
# May 20, 2006 5:11 PM

buy xanax said:

i like your website very much but please do get us more information about it
# June 3, 2006 7:18 AM

Jawi said:

Hi,

Can you post the source please.

The link is dead

Thanks,

Jawi

# October 12, 2006 8:07 PM

GusPerez said:

Hi Jawi, I've gone ahead and updated the link. Note it's no longer the code for the latest version but close enough. The latest just has changes to safer string APIs. Other than that it didn't really change much if I recall correctly.

-gus

# October 14, 2006 4:02 AM

inerrability Dublin said:

Features:A tiny Win32 application (C++) that displays the system's up-time either in a small (transparent) window on your desktop or in a tool tip whenever you hover over the UpTime 2000 icon in the system tray.

I do not agree. Go to http://www.hotelsgames.info/onus_Republic%20of%20Ireland/pliocene_Leinster/inerrability_Dublin_1.html

# November 15, 2006 2:41 PM
New Comments to this post are disabled
Page view tracker