Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

searching

Status
Not open for further replies.

jh508

Technical User
Mar 26, 2001
8
0
0
US
Can someone please point me in the right direction to find info on how long a program has run, I have searched with little luck on this subject, thanks.
 
heres a very rough solution:-

Private Declare Function QueryPerformanceCounter Lib "kernel32" ( _
lpPerformanceCount As Currency _
) As Long

Private Declare Function QueryPerformanceFrequency Lib "kernel32" ( _
lpFrequency As Currency _
) As Long

Dim myFreq As Currency
Dim myStart As Currency
Dim myStop As Currency
Dim TotalTime As Double

Private Sub Form_Load
QueryPerformanceFrequency myFreq
QueryPerformanceCounter myStart
End Sub

Private Sub Form_Unload(Cancel As Integer)
QueryPerformanceCounter myStop
TotalTime = CDbl((myStop - myStart) / myFreq)
'save time to file
Exit Sub

good luck!

If somethings hard to do, its not worth doing - Homer Simpson
------------------------------------------------------------------------
A General Guide To Excel in VB FAQ222-3383
File Formats Galore @
 
hmmm.. teach me to read the post properly.

you want to find out how long another program (not one you have written) has been up for?!?!

If somethings hard to do, its not worth doing - Homer Simpson
------------------------------------------------------------------------
A General Guide To Excel in VB FAQ222-3383
File Formats Galore @
 
If it is a program you have written, couldnt you just write the time that its loaded out to a text file?

Transcend
[gorgeous]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top