Hi RandomCoder
It's a bit cluttered but this works for me for a while:
Sub App_Start
reg.New1
honyaku="your_registration_code"
Registration
:::::::::
End Sub
Sub Registration
frmRegistration.Show 'A form with a text box and an OK button
Do
DoEvents
Loop Until mnuRegister.Enabled=False
If txtRegister.Text=honyaku Then
Return 'continue with code in App_Start
Else
AppClose 'or prohibit any further use after tap on (ok) if the registration key is wrong
End If
Else
MsgBox("Unregistered Version!"," Shareware Info", cMsgBoxNone, cMsgBoxAsterisk)
End if
End If
End Sub
Sub buttRegister_Click 'the OK button
if txtRegister.Text=honyaku Then
reg.RootKey(reg.rtCurrentUser)
key = "Software\RBSoft\Mokusei"
reg.SetStringValue(Key,"Owner",honyaku)
MsgBox("The software is now registered. Thank you!"," Shareware Info", cMsgBoxNone, cMsgBoxAsterisk)
mnuRegister.Enabled=False
Else
MsgBox("Wrong registration key!"," Shareware Info", cMsgBoxNone, cMsgBoxHand) 'mnuRegister still enabled
End if
End Sub
Sub mnuRegister_Click
frmRegistration.Show
End if
Please be aware that the registration key in honyaku="your_registration_code" in the compiled exe is visible in a HEX viewer, hence not safe enough a solution.