I have code below to check for piracy of my software. Though it is not the best out there but perhaps way to make it harder or annoying to be pirated.
I call the above procedure on mdiform form_activate event. But I notice that the toolbar on my mdiform hangs until I open up a new form where the whole app gui is refreshed.
chknw procedure is an if statement checking the existence of license file, comparing license from license file and checking expiry date from license file. I dont think this causes application to hang.
Can you advice me how I can optimize that code in order not to cause application hang.
.
Code:
Public Sub CheckForPiracy(num As Long)
Dim PauseTime, Start
PauseTime = num
Start = Timer
Do While Timer < Start + PauseTime
DoEvents ' Yield to other processes.
Loop
Call chknw 'This will check if the license is available, expired o correct. If not, shutdown the
Dim i As Long
i = RandomNumber(7200, 300)
CheckForPiracy(i) 'repeat the procedure
End Sub
chknw procedure is an if statement checking the existence of license file, comparing license from license file and checking expiry date from license file. I dont think this causes application to hang.
Can you advice me how I can optimize that code in order not to cause application hang.
.