Count how many times the program was open

I want program to remember how many times it has been open and then beable to do something with that info.  Like:

If 'program has been opened 30 times Then.....

That type of thing.
mrcool4444Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Erick37Connect With a Mentor Commented:
This is easy:

Private lRuns As Long

Private Sub Form_Load()
lRuns = CLng(GetSetting(App.Title, "Startup", "Runs", "1"))
Caption = "Program Ran " & lRuns & " Times"
End Sub

Private Sub Form_Unload(Cancel As Integer)
lRuns = lRuns + 1
SaveSetting App.Title, "Startup", "Runs", CStr(lRuns)
End Sub
0
 
kamallCommented:
A possible solution is to create an INI file when your program loads for the first time. You can put this file somewere like in the system dir. so that the user will not find it easily. You can even set its extension to DLL or something like that so that the user will almost never discover it.
Each time your program loads, you read the number of times run (from the INI file), add +1 and save the new number.
When 30 is reached, do what you intend to do.
If you need code, comment me.
Regards.
0
 
Erick37Commented:
Use
SaveSetting and GetSetting
to store this info to the registry.
0
 
mrcool4444Author Commented:
No, I know there is some way to do it with code, I just don't remember where I saw it.  Using .ini and or .dll is a little more complicated than I want to get into.
0
 
kamallCommented:
mrcool4444,
There is NO WAY to do it either than saving some info on the system, either in a file or in the windows registry.
So what is your *other* way to do it?
0
All Courses

From novice to tech pro — start learning today.