昆虫记读书心得500字:如何制作需要输入序列号的软件安装包

来源:百度文库 编辑:高考问答 时间:2024/04/28 12:19:19
我想知道如何制作需要输入序列号后才能安装的软件安装包
http://www.wonsun.com.cn/product/epcad_14_clip_image004.jpg
类似这样的安装包,只有输入了合法注册信息后才能正常安装
当然不是固定的了,我是拿来当软件注册机制用的,
我用的安装包封装软件是:CreateInstall Pro
本身也自带了一个序列号的对话框,但是不太会用
http://bbs.jcrx.com/cgi-bin/lb5000/topic.cgi?forum=24&topic=12764&show=0
哪位高手能告诉我怎么用?或者有别的方法也可以告知一下,谢谢!

该对话框代码如下:

[Help]

[Macros]
ser_left=0
ser_right=14
ser_head=1
ser_headbmp=logo.bmp
ser_left=0
ser_leftbmp=
;Language Resources
lser_head=软件序列号
lser_subhead=请输入序列号码。
lser_text=若要继续安装,您必须输入软件序列号。
lser_sertext=软件安装序列号:

[Dialog]
STATIC,#stchild#,$_pages$00,0,0,0,0,SerialFunc
STATIC,#whiterect#,$_pages$20,0,0,300,34,
SO_Bitmap,#lefttext#,$_pages$21,263,2,30,30,
STATIC,#line#,$_pages$22,0,34,303,1,
SO_Text,#lefttext#,$_pages$23,7,4,200,10,
SO_Text,#lefttext#,$_pages$24,20,15,205,16,
STATIC,#lefttext#,$_pages$50,20,55,260,40,
STATIC,#righttext#,$_pages$52,90,110,60,14,
STATIC,#line#,$_pages$32,0,190,303,1,
BUTTON,#btnpush#,$_pages$28,184,198,50,14,
BUTTON,#btnpush#,$_pages$29,242,198,50,14,
BUTTON,#btnpush#,$_pages$27,130,198,50,14,
EDIT,#edit#,$_pages$51,155,110,50,14,
EDIT,#edit#,$_pages$56,210,110,50,14,

[Function]
func dword SerialCheck{ dword id1 id2 }
{
var { dword ret val1 val2
str istr }

val1 = MacroGetDw( "ser_left" )
val2 = MacroGetDw( "ser_right" )

if { val1 && val1 * 2 == val2 }
{
return $DLG_RETNEXT
}
MessageWarning( "错误的序列号码!")
DlgFocusItem( id1 )

return ret
}

func dword SerialFunc{ dword dlg id ctl codedlg }
{
var { dword ret page opened
str istr
}
page = DlgGetPage( dlg ) * 100
if { !id }
{
MacroSetDw( "_custpage", DlgGetPage( dlg ))
MacroLoad( setfile, MacroDone( "DlgMacro#_custpage#" ))

MacroSetStr("pref", "ser_")
DlgBeforeAction( dlg, &opened )
DlgSetTextItem( page + 50, "#lser_text#" )
DlgSetTextItem( page + 52, "#lser_sertext#" )

DlgSetTextItem( page + 51, "#ser_left#" )
DlgSetTextItem( page + 56, "#ser_right#" )

// define EM_LIMITTEXT 0x00C5
$SendMessage( DlgItem( page + 51 ), 0x00C5, 5, 0L)
$SendMessage( DlgItem( page + 56 ), 0x00C5, 10, 0L)

DlgAfterAction( dlg, opened, page )
}
if { id == 0xFFFF }
{
DlgFocusItem( page + 51 )
}
if { id == page + 28 || id == $IDOK }
{
DlgGetMacroItem( page + 56, "ser_right" )
DlgGetMacroItem( page + 51, "ser_left" )
ret = SerialCheck( page + 51, page + 56 )
}

if { id == page + 27 }
{
DlgGetMacroItem( page + 56, "ser_right" )
DlgGetMacroItem( page + 51, "ser_left" )
ret = $DLG_RETPREV
}

if { ( id == page + 29 || id == $IDCANCEL ) && DlgIsExit() }
{ SetupClose( 1 ) }
return ret
}