Length of time shell is active 
Author Message
 Length of time shell is active

Hi,

I am currently writing a launch program to launch certain
applications.  I have also been asked to supply a log record showing
how long the applicaton was active.  

It may be something simple but how can I tell when the application
has ended, in order to use the elapsed time for a cost calculation?

All help gratefully recieved. I have been on this for a while, so
maybe I cant see the wood for the trees.

TIA

John

--
~~~  In the immortal words of Socrates...........  I drank what??  ~~~
~~~                                                                ~~~

~~~  Sandwick, Shetland         Tel:     +44(0)1950 431430         ~~~



Tue, 19 May 1998 03:00:00 GMT  
 Length of time shell is active

(John Mesure) threw this at us:

Quote:
>I am currently writing a launch program to launch certain
>applications.  I have also been asked to supply a log record showing
>how long the applicaton was active.  
>It may be something simple but how can I tell when the application
>has ended, in order to use the elapsed time for a cost calculation?

' -- One line
Declare Function GetModuleUsage Lib "Kernel" (ByVal hModule As
Integer) As Integer

' Goes in the procedure where you start the app
x% = Shell("myapp.exe")

Do While GetModuleUsage(x%) <> 0
   Seconds = Seconds + (Timer - Seconds)
   DoEvents
Loop

Msgbox "Myapp ran for " & Seconds & " seconds"

Jens
--
* Everything I said are the opinions of someone else.   *
* I just cut-and-pasted.                                *

Jens Balchen jr.

P.O.Box 6052
N-4602 Kristiansand



Wed, 20 May 1998 03:00:00 GMT  
 Length of time shell is active
You can use a timer that checks every now and than wether the app
is running.
You check if its running by using the function getmodulehandle.
And with the retrieved handle you can see with getModuleUsage how
many of them are running. These are API functions.  Use the
following declare statement:

Declare Function GetModuleHandle Lib "Kernel" (ByVal lpModuleName
As String) As Integer

Declare Function GetModuleUsage Lib "Kernel" (ByVal hModule As
Integer) As Integer

Use the following statement in your code:
handle = GetModuleHandle ("Your apps exe name")

If the handle is anything different from 0 then the App is running
atleast once

The statement:
Times = GetModuleUsage (handle)
Times gives the number of times the app is running



Wed, 27 May 1998 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. How do i know the time a program is active, started with shell in VB5

2. Format date/time in DTPicker to display AM/PM or 24 hour time

3. Active program: keeping the app active and checking time

4. Fixed length strings and user types in Active-X DLL

5. Active X DataCombo Visible List length??

6. MP3 Time Length Info

7. how do i get the length in seconds of play time of an audio file

8. Length of Time Printing Report

9. Am I lucky or just playing with time?!

10. Am I running in design-time ?

11. Regular expression - It should be easy, but I am having a bad time

12. Time function, displaying AM PM

 

 
Powered by phpBB® Forum Software