Count Program Executions 
Author Message
 Count Program Executions

How do I write a VB6 program to count the number of times the program has
been executed and save the result in a file.

Sounds trivial, but is has me stumped.

Many Thanks



Mon, 24 Oct 2005 11:46:29 GMT  
 Count Program Executions

Quote:
> How do I write a VB6 program to count the number of times the program has
> been executed and save the result in a file.

> Sounds trivial, but is has me stumped.

On startup:
* check if the file is there
*
* if not
    * Create file
    * write counter = 1 to file
    * close file
*
* If there,
    * open file,
    * read counter
    * counter++
    * write counter back to file
    * Close file
* Contuinue with rest of program

--
Dag.



Mon, 24 Oct 2005 16:00:04 GMT  
 Count Program Executions
Couldn't you have a registry setting that increments by 1 each time
the program is run?

The GetSetting / SaveSetting commands can be used as below;

Sub Main
Dim iTimes As Long

  iTimes = GetSetting(App.Title, "Settings", "Times", 0)

  SaveSetting App.Title, "Settings", "Times", iTimes + 1

  ..............
  Blah blah blah
  Yadder yadder yadder
  ..................
End Sub

Hope this helps.



Mon, 24 Oct 2005 19:54:24 GMT  
 Count Program Executions
Probably the OP wants to monitor how many times a 3rd party EXE has
been run

Otherwise he/she or (?) would not have asked such an apparently naive
question in the first place.

CreateToolhelp32Snapshot comes to mind
- but there are problems on NT

Basically 'snoop' the EXEs and 'remember' the time they started and
stopped.
Also think about whether the App is active
- GetForegroundWindow springs to mind

Gawd - I've just realized
- this guy is trying to find out what people are doing
- using Excel or playing Doom



Quote:
>Couldn't you have a registry setting that increments by 1 each time
>the program is run?

>The GetSetting / SaveSetting commands can be used as below;

>Sub Main
>Dim iTimes As Long

>  iTimes = GetSetting(App.Title, "Settings", "Times", 0)

>  SaveSetting App.Title, "Settings", "Times", iTimes + 1

>  ..............
>  Blah blah blah
>  Yadder yadder yadder
>  ..................
>End Sub

>Hope this helps.



Mon, 24 Oct 2005 21:04:28 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. How to count a execution time?

2. Help - Module Execution in another program

3. Pausing program execution

4. Displaying Cursor during program execution

5. CA-Realizer program execution speed problem !!!

6. Remote execution of programs

7. Question on Program Execution.

8. Ending program execution

9. clicking on menus stops program execution.??

10. Stopping Execution of an MS-DOS program from VB

11. program to monitor execution and shutdown of applications

12. How to delay execution of a program?

 

 
Powered by phpBB® Forum Software