set ENGINEBEHAVIOR 70
set safety off
set century on
set date YMD
set sysmenu off
set talk off
set status bar off
set confirm on
set deleted on
set multilocks on
set exact on
set resource off
set procedure to proc ADDITIVE
set default to JUSTPATH(SYS(16,0))
_screen.picture = "BANK.JPG"
_screen.windowstate = 2
_SCREEN.addproperty("cTitle")
_SCREEN.addproperty("cPath")
_SCREEN.addproperty("cUser")
_SCREEN.addproperty("cCPUID")
_SCREEN.addproperty("lReg")
_SCREEN.addproperty("cHb")
_SCREEN.addproperty("Ver")
_screen.ver = "V2.20"
_screen.cpath = SYS(5)+CURDIR()
_screen.ctitle = "星空软件"
_screen.caption = "超越迷你进销存 医药版"+_SCREEN.ver
_screen.icon = "lighton.ico"
_screen.visible = .t.
if not DIRECTORY("data")
MESSAGEBOX("本程序运行目录下不存在数据文件目录“data”,系统将自动退出。",16,"系统自检...")
quit
endif
if not checkdata()
MESSAGEBOX("数据自检失败!引起此原因可能是由于突然断电或意外死机造成的数据损坏。"+CHR(13)+"请使用数据修复工具检查数据库!"+CHR(13)+CHR(13)+"如果修复后问题此窗口仍然出现,请与我们联系!"+CHR(13)+CHR(13)+"技术支持:0631-5625456",16,"数据自检失败")
if FILE("repair.exe")
run /n repair
endif
quit
endif
if DIRECTORY("cytemp")
lnxw = MESSAGEBOX("在上次软件运行过程中可能出现过死机或断电等意外问题,系统非正常退出。"+CHR(13)+CHR(13)+"为了保证数据安全,系统将进行数据库校验! "+CHR(13)+CHR(13)+"注意,校验完成后系统将自动退出。请重新登录运行系统。",64,"系统启动自检")
delete file cytemp\*.*
rd cytemp
do verify
else
md cytemp
close databases all
copy file data\*.* to cytemp
endif
declare integer DiskID32 in DiskID32.DLL string @, string @ 注意:取得磁盘物理ID为机器码
a = REPLICATE(CHR(0),31)
b = REPLICATE(CHR(0),31)
retval = DISKID32(@A,@B)
_screen.ccpuid = ALLTRIM(LEFT(B,AT(CHR(0),B)-1))
for n = 1 to 10
if EMPTY(_SCREEN.ccpuid)
_screen.ccpuid = ALLTRIM(LEFT(B,AT(CHR(0),B)-1))
else
exit
endif
endfor
if EMPTY(_SCREEN.ccpuid)
_screen.ccpuid = "FA780203" 如磁盘物理ID为空机器码为FA780203
endif
lczcm = "AAAAA"
set procedure to proc ADDITIVE
if not FILE("reginfo.mem")
_screen.lreg = .f.
else
restore from reginfo additive
if regedit(_SCREEN.ccpuid,427) <> LCZCM 比较注册码,调用到函数regedit
_screen.lreg = .f.
else
_screen.lreg = .t. 注册码正确则通过
endif
endif
set safety off
select 0
use data\销售出库
if AFIELDS(AA) <> 14
on shutdown quit
MESSAGEBOX("你所使用的数据格式比较老,必需升级才能使用!",16,"提示")
do form scx\update
read events
quit
endif
use in 销售出库
if _SCREEN.lreg = .f.
use data\销售出库 exclusive
pack
count to lnsum
if LNSUM > 500
MESSAGEBOX("对不起,未注册版本不能无限制地使用本软件。请与软件供应商联系!",16,"软件试用期已过")
do form scx\zc with 1
read events
endif
endif
use data\system
_screen.chb = HBFH
use
set help to myhelp.chm
on key label F3 do usepos
on error do myerror
on shutdown do myShutDown
_SCREEN.addproperty("jbzl")
_SCREEN.addproperty("cgrk")
_SCREEN.addproperty("xsck")
_SCREEN.addproperty("xsthh")
_SCREEN.addproperty("qtkcbd")
_SCREEN.addproperty("szlr")
_SCREEN.addproperty("ywbb")
_SCREEN.addproperty("ywls")
_SCREEN.addproperty("xtwh")
do form scx\sfyz
read events
procedure keymove
parameters inno
do while .t.
do case
case INNO < 65
inno = INNO+26
case INNO > 90
inno = INNO-26
otherwise
exit
endcase
enddo
return INNO
--------------------------------------------------------------------------------
【经验总结】
该软件的注册算法大致如下:
1、将不足25位机器码在右边补0
2、设置循环生成注册码
3、交叉取机码和生成码,其中生成码减去传入参数inusers,截取字符串开始为取1-25/30的余数
4、返回前25位为注册码
5、注册机已编写完毕
由于本人用PB编程只好用PB编写注册机了。以下为代码:
string outmsg, cbaseid,inmsg
int nstep,inusers
long nmod
//inmsg=trim(sle_jqm.text)
inmsg="你的机器码"
inusers=427
cbaseid = "SDFSDFSDFSLFDKGL09345-=2389234"
outmsg = ""
for nstep = 1 to LEN(INMSG)
nmod = MOD(NSTEP,LEN(CBASEID))
outmsg = OUTMSG+CHAR(keymove(ASC(MID(INMSG,NSTEP,1))+ASC(MID(CBASEID,NMOD,1))-INUSERS))
end for
sle_xlh.text=outmsg
key函数
do while true
choose case inno
case is <65
inno = inno+26
case Is > 90
inno = inno - 26
case else
exit
end choose