用InstallShield打包ASP程序[1]

[入库:2005年8月18日] [更新:2007年3月24日]

本文简介:选择自 jaron 的 blog

#include "ifx.h" //不能移动
//////////////////////////////////////////////////////////////////////////////
// 用installshield 进行 asp 软件的打包和自动安装
// 原创作者: 贾俊 (jaron)
// 网址: http://www.jiangdu.net
// 邮件: jaron@jdinfo.net
// 首次发表于网易,chinaasp,asphouse
//////////////////////////////////////////////////////////////////////////////
// 功能:
// 1.文件复制
// 2.可选自动设置独立站点运行(设置iis)
// 3.可选自动设置虚拟站点运行(设置iis)
// 4.设置目录可读,可写及可运行脚本
// 5.自动创建odbc
// 6.自动创建或附加mdf格式的sql数据库 并优化
// 7.自动安装 scriptencode 解码程序
// 本文仅列出了 installshield 的 script 部分,还有两个 vbs 文件及其他设置
// 测试过程中有任何问题,请来 http://www.jiangdu.net/bbs 编程空间版 讨论
//////////////////////////////////////////////////////////////////////////////
prototype createdatabase(string,string,string);
prototype createwebsite(string,string); // 创建 iis 站点
prototype createvirtualdir(string); // 创建虚拟目录

//////////////////////////////////////////////////////////////////////////////
//
// 函数: onfirstuibefore
//
// 事件: firstuibefore event is sent when installation is run for the first
// time on given machine. in the handler installation usually displays
// ui allowing end user to specify installation parameters. after this
// function returns, componenttransferdata is called to perform file
// transfer.
//
///////////////////////////////////////////////////////////////////////////////
function onfirstuibefore()  
number nresult,nsetuptype,nopt,svedit1,svedit2;
string sztitle, szmsg,szbmppath;
string szlicensefile, szquestion;
string szserverip,szserverport,szserveripdefault,szserverportdefault;
string szsqlsvr,szsqlusr,szsqlpwd,svsqlsvr,svsqlusr,svsqlpwd;
string svname, svcompany, svserial;
string szfile,sztargetpath,szdir,szfolder;
string szcomponents, sztargetdir;
string szfield1,szfield2;
string szdefault,svresult;
object piisobj;
list list,liststartcopy;
number nlevel,nvsize;
begin

szbmppath="c:"^"temp"^"left.bmp";
dialogsetinfo (dlg_info_altimage, szbmppath, true); // 设置左边的图片
//to do: if you want to enable background, window title, and caption bar title
//settitle( @title_main, 24, white );
//settitle( @title_captionbar, 0, backgroundcaption );
//enable( fullwindowmode );
//enable( background );
//setcolor(background,rgb (0, 128, 128));

//默认值设定
targetdir = "c:"^"inetpub"^"jaronsoft"^@folder_name;
szdir = targetdir;
shell_object_folder = @folder_name;
svname = "试用版用户";
svcompany = "jdinfo network";
svserial = "111-1111111";

dlg_start:
// beginning of dialogs label

dlg_sdwelcome: //欢迎 对话框
sztitle = "欢迎进入";
szmsg = "";
nresult = sdwelcome( sztitle, szmsg );
if (nresult = back) goto dlg_start;

dlg_sdlicense://软件许可协议 对话框
szlicensefile = supportdir ^ "license.txt";
sztitle = "许可协议";
szmsg = "";
szquestion = "";
nresult = sdlicense( sztitle, szmsg, szquestion, szlicensefile );
if (nresult = back) goto dlg_sdwelcome;

dlg_sdshowinfolist://readme文件 对话框
szfile = supportdir ^ "infolist.txt";
list = listcreate( stringlist );
listreadfromfile( list, szfile );
sztitle = "readme";
szmsg = "";
nresult = sdshowinfolist( sztitle, szmsg, list );
listdestroy( list );
if (nresult = back) goto dlg_sdlicense;

dlg_sdregisteruserex://用户信息 对话框
szmsg = "";
sztitle = "用户信息";
nresult = sdregisteruserex( sztitle, szmsg, svname, svcompany, svserial );
if (nresult = back) goto dlg_sdshowinfolist;
//检查序列号
//if (chk_serial(svcompany, svserial)<0) then
//goto dlg_sdregisteruserex;
//endif;
//检查序列号完毕
dlg_sdaskdestpath://安装位置 对话框
sztitle = "检查序列号";
szmsg = "";
nresult = sdaskdestpath( sztitle, szmsg, szdir, 0 );
targetdir = szdir;
if (nresult = back) goto dlg_sdregisteruserex;

dlg_setuptype: //安装类型 对话框
nsetuptype = typical;
sztitle = "安装类型";
szmsg = "请选择您需要按哪种方式安装";       
nresult = setuptype ( sztitle , szmsg , "" , nsetuptype , 0 );
if (nresult = back) then
 goto dlg_sdaskdestpath;
else
 nsetuptype = nresult;
 if (nsetuptype != custom) then
  sztargetpath = targetdir;
  nvsize = 0;
  componentcomparesizerequired(media,sztargetpath,nvsize);
  if (nvsize != 0) then
   messagebox( szsdstr_notenoughspace, warning );
   goto dlg_setuptype;
  endif;
 endif;
endif;

dlg_sdcomponenttree: //对话框
if ((nresult = back) && (nsetuptype != custom)) goto dlg_setuptype;
sztitle = "对话框";
szmsg = "";
sztargetdir = targetdir;
szcomponents = "";

本文关键:InstallShield,打包
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top