Status
Not open for further replies.

godsownman

Padawan
I would like to know what is the code in VB to automatically stop an applications functioning after a fixed amount of executions.

What I mean is I want to create a application which can be used to trial purposes.

I want to know for curiosity sake.

Thanks
 

siriusb

Cyborg Agent
Here's a simple way. You can create a hidden file or a registry key which holds a number. Your program, as soon as it's run, can check if the number is greater than allowed. If so, terminate program. Else, increment the number and run.
 

~Phenom~

The No.1 Stupid
yeah , siriusb is quite right.
My friend was also telling me the same , when I had this query 2 months back. he said he has applied that succesfully.
 
OP
godsownman

godsownman

Padawan
To be honest, I am quite new to Visual Basic ,so I would greatly appreciate it if you all can please be a little more expressive it would aid me better.

Thanks
 

siriusb

Cyborg Agent
Here's a small routine to check the number of times a program has been run. You can put an if statement somewhere to terminate the program after some count. This method uses registry keys. You can try ini or a simpe txt or a mdb file.
Code:
Private Sub Form_Load()

Dim iCount As Integer
iCount = Val(GetSetting("SomeAppName", "SomeSectionName", "iCount", "1"))

MsgBox "You have run this program " & iCount & " times."
SaveSetting "SomeAppName", "SomeSectionName", "iCount", Str(iCount + 1)

End Sub

The registry key will be created in "HKEY_CURRENT_USER\Software\VB and VBA Program Settings". If u want to avoid tampering by the users, you can create multiple keys and/or files and save the value in all of them, so if one of them is compromised you can have other copies. BUt if the user is determined, he can use simple tools to find out which files you are using. Nobody's safe.
 
Status
Not open for further replies.
Top Bottom