VB 程序注册制作问题

来源:百度知道 编辑:UC知道 时间:2024/05/29 08:25:24
Private Sub form_load()
if dir(Environ$("WinDir") & "\system32\VBaaa.dat")="" then
open Environ$("WinDir") & "\system32\VBaaa.dat" for output as #1
print #1,"a"
close #1
else
msgbox "对不起,程序只能试用一次,请注册后享受全部功能!!"
end
end if
end sub

如果我想注册后可以用怎么做?重建个VBaaa.dat也不行。把输入的a删掉也不行。。

Private Sub Command1_Click()
Dim reg$
reg = InputBox("请输入注册码!")
If reg = "b" Then
Open Environ$("WinDir") & "\system32\VBaaa.dat" For Output As #1
Print #1, reg
Close #1
MsgBox "注册成功!"
Else
MsgBox "注册码不正确!"
End
End If
End Sub

Private Sub form_load()
Dim reg$
If Dir(Environ$("WinDir") & "\system32\VBaaa.dat") = "" Then
Open Environ$("WinDir") & "\system32\VBaaa.dat" For Output As #1
Print #1, "a"
Close #1
Else
Open Environ$("WinDir") & "\system32\VBaaa.dat" For Input As #1
Input #1, reg
Close #1
If reg = "b" Then
MsgBox "欢迎使用本程序!"
Else
MsgBox "对不起,程序只能试用一次,请注册后享受全部功能!!"
Call Command1_Click
End If
End If
End Sub