VB icon

Get and Save how many times your prog was loaded

Email
Submitted on: 1/3/2015 1:53:00 AM
By: DoWnLoHo (from psc cd)  
Level: Not Given
User Rating: By 14 Users
Compatibility: VB 4.0 (32-bit), VB 5.0, VB 6.0
Views: 477
 
     This code will allow you to Save & Get how many times your program has been loaded. Add a few lines of code to your program's main forms' load procedure. Very easy to understand.
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
				
'**************************************
' Name: Get and Save how many times your prog was loaded
' Description:This code will allow you to Save & Get how many times your program has been loaded.
Add a few lines of code to your program's main forms' load procedure. Very easy to understand.
' By: DoWnLoHo (from psc cd)
'
' Returns:Returns as Long
'**************************************

Public Sub SetLoaded()
'put this in your main forms' Load procedure
'this will set the count
Dim lTemp As Long, sPath As String
lTemp& = GetLoaded&
If Right$(App.Path, 1) <> "\" Then sPath$ = App.Path & "\" & App.EXEName & ".tmp" Else sPath$ = App.Path & App.EXEName & ".tmp"
Open sPath$ For Output As #1
Print #1, lTemp& + 1
Close #1
End Sub
Public Function GetLoaded() As Long
'call this to get how many times program has been loaded
On Error Resume Next
Dim sPath As String, sTemp As String
If Right$(App.Path, 1) <> "\" Then sPath$ = App.Path & "\" & App.EXEName & ".tmp" Else sPath$ = App.Path & App.EXEName & ".tmp"
Open sPath$ For Input As #1
sTemp$ = Input(LOF(1), #1)
Close #1
If sTemp$ = "" Then GetLoaded& = 0 Else GetLoaded& = CLng(sTemp$)
End Function
'works well
'DoWnLoHo


Other 13 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Not Given category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.