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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
Erick37Commented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.