installshield实例代码

这是一个基于InstallShield的安装脚本,用于配置IIS站点、创建虚拟目录,以及设置ODBC数据源。脚本包含函数如`CreateWebSite`、`CreateVirtualDir`和`odbc`,用于自动化安装过程中的系统配置。用户在安装过程中需输入服务器信息,选择运行模式,并确认安装路径等参数。安装脚本还涉及了与Microsoft SQL Server的交互,包括数据库的创建、优化和权限设置。
摘要由CSDN通过智能技术生成

完整的installshield代码- -

//  
// File Name: Setup.rul  
//  
// Description: InstallShield script  
//  
// Comments: This script was generated based on the selections you made in
// the Project Wizard. Refer to the help topic entitled "Modify  
// the script that the Project Wizard generates" for information
// on possible next steps.
//


// Include header files
   
#include "ifx.h"  
#include "util.h"
   
// string defines
installation declarations ///
// ----- DLL function prototypes -----

  // your DLL function prototypes

// ---- script function prototypes -----

  // your script function prototypes
  prototype CreateMyIniFile();  
  prototype CreateMyIniFile2();
  prototype Createsearchfile(); 
  prototype Createviewfile(); 
  prototype UpdateGaiscfg();
  prototype CreateShortCut();
  prototype DelConfigFile();
  //prototype CreateDataBase(STRING,STRING,STRING);
 prototype CreateWebSite(STRING,STRING); // 创建 IIS 站点
 prototype CreateVirtualDir(STRING); // 创建虚拟目录 
 prototype CreateVirtualDir1(STRING); // 创建IIS站点的虚拟目录  
 //prototype odbc();//ODBC创建
  prototype odbc();//ODBC创建 
  prototype CreateDataBase();
 
  // your global variables
  external BOOL g_bRemoveIniFile;
  string g_sMyComputername;
  STRING szServerIP,szServerPort,szServerIPDefault,szServerPortDefault;
  NUMBER svEdit1,svEdit2,svEdit3;
function OnBegin()  
 string szMsg;
begin  
 /*
 if ( !SYSINFO.bIntel) then 
 szMsg = "提示:该软件只能运行在Intel系列的处理器上!/n/n安装程序将终止"; 
 MessageBox(szMsg, SEVERE); 
 abort; 
 endif;  
 */  
 //szMsg= _GetComputerIP();
 //MessageBox(szMsg, SEVERE);
 //abort;
 if( !(SYSINFO.WINNT.bWinNT4 ||SYSINFO.WINNT.bWin2000 ) ) then
 szMsg = "提示:该软件只能运行在NT4 或 Win2000 系统上才能确保程序的正常工作!"; 
 MessageBox(szMsg, SEVERE); 
 abort; 
 endif;  
//g_sMyComputername= _GetComputerIP();
//MessageBox(g_sMyComputername, INFORMATION);  
//abort;
end;

//
//  
// FUNCTION: OnFirstUIBefore  
//  
// EVENT: 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;
 STRING szTitle, szMsg,szBmpPath;
 STRING szLicenseFile, szQuestion;
 
 STRING szSQLsvr,szSQLusr,szSQLpwd,svSQLsvr,svSQLusr,svSQLpwd;
 STRING szName, szCompany, szSerial;
 STRING szFile,szTargetPath,szDir,szfolder;
 STRING szComponents, szTargetdir;
 STRING szField1,szField2,szField3;
 STRING szDefault,svResult;
 OBJECT piisObj;
 LIST list,listStartCopy;
 NUMBER nLevel,nvSize;  
 string myComputerIp;  
 
begin 
  // 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 = "D:"^"macro_china//"; //PROGRAMFILES ^@COMPANY_NAME ^@PRODUCT_NAME; 
  szDir = TARGETDIR;
  SHELL_OBJECT_FOLDER = @FOLDER_NAME;
  szName = "中国宏观经济信息网";
  szCompany = "macrochina";
  szSerial = "1111-1234-5678";  
   
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 = "1234";
  // szMsg = "赌东道的";
  //szQuestion = "暗暗";
  //nResult = SdLicense( szTitle, szMsg, szQuestion, szLicenseFile );
  // if (nResult = BACK) goto Dlg_SdWelcome;
Dlg_SdRegisterUserEx:
  szMsg = "";
  szTitle = ""; 
  nResult = SdRegisterUserEx( szTitle, szMsg, szName, szCompany, szSerial );
  //检查序列号 
 //if (CHK_serial(svCompany, szSerial)<0) then 
 //goto Dlg_SdRegisterUserEx; 
 //endif; 
 //检查序列号完毕 
 
  //nResult = SdRegisterUser( szTitle, szMsg, szName, szCompany );
  // if (nResult = BACK) goto Dlg_SdLicense;
  if (nResult = BACK) goto Dlg_SdWelcome;

Dlg_SdAskDestPath:
  szTitle = "";
  szMsg = "";
  nResult = SdAskDestPath( szTitle, szMsg, szDir, 0 );
  TARGETDIR = szDir;
  if (nResult = BACK) goto Dlg_SdRegisterUserEx;
 
Dlg_SdComponentTree: 
  if ((nResult = BACK) && (nSetupType != CUSTOM)) goto Dlg_SdRegisterUserEx; //Dlg_SdAskDestPath;
  szTitle = "";
  szMsg = "";
  szTargetdir = TARGETDIR;
  szComponents = "";
  nLevel = 2;
  if (nSetupType = CUSTOM) then
  nResult = SdComponentTree(szTitle, szMsg, szTargetdir, szComponents, nLevel);
  if (nResult = BACK) goto Dlg_SdAskDestPath; //Dlg_SdRegisterUserEx; //Dlg_SdAskDestPath;  
  endif;
Dlg_ObjDialogs:
  nResult = ShowObjWizardPages(nResult);
  if (nResult = BACK) goto Dlg_SdComponentTree; 
   
   
Dlg_SdSelectFolder:
  szfolder = SHELL_OBJECT_FOLDER; 
  szTitle = "";
  szMsg = "";
  nResult = SdSelectFolder( szTitle, szMsg, szfolder );
  SHELL_OBJECT_FOLDER = szfolder;
  if (nResult = BACK) goto Dlg_ObjDialogs;  
   
Dlg_SelMode ://设置数据库服务器 对话框
 szTitle = "设置"+@PRODUCT_NAME+"的运行模式";
 szMsg = "请选择软件运行的方式,极力推荐使用独立站点方式运行";
 szField1="独立站点方式运行(自动创建新站点)"; 
 szField2="虚拟目录方式运行(自动在默认Web上创建虚拟目录)";
 szField3="手工建立中宏数据库站点";
 svEdit1=TRUE;
 svEdit2=FALSE; 
 svEdit3=FALSE;
 SetDialogTitle(DLG_ASK_TEXT,szTitle); 
 //DialogSetInfo ( DLG_INFO_CHECKSELECTION, "", 1); 
 nOpt = EXCLUSIVE ;
 nResult = AskOptions (nOpt,szMsg,szField1,svEdit1,szField2,svEdit2,szField3,svEdit3);
 if (nResult = BACK) goto Dlg_SdSelectFolder;
 if (svEdit1=FALSE) goto Dlg_SdStartCopy;
 Dlg_AskText ://设置数据库服务器 对话框
 szTitle = "设置IIS信息服务及数据库服务器";
 szMsg = "现在开始设置IIS系统";
 szQuestion=" 请输入本服务器的主机名或IP地址,安装程序将按照您提供的资料设置IIS信息服务。如果您没有填写,安装程序将自动跳过站点的创建!";
 szServerIP="地址:";
 szServerPort="端口:"; 
 myComputerIp= _GetComputerIP();
 szServerIPDefault=myComputerIp;
 szServerPortDefault="8088";
 SetDialogTitle(DLG_ASK_TEXT,szTitle);
 nResult=SdShowDlgEdit2 (szTitle, szQuestion,szServerIP,szServerPort,szServerIPDefault,szServerPortDefault);
 if (nResult = BACK) goto Dlg_SelMode;
 
Dlg_SdStartCopy:
  szTitle = "";
  szMsg = "";
  listStartCopy = ListCreate( STRINGLIST );
  //The following is an example of how to add a string(szName) to a list(listStartCopy).
  //eg. ListAddString(listStartCopy,szName,AFTER);  
 ListAddString(listStartCopy,"用户名:" + szName,AFTER); 
 ListAddString(listStartCopy,"用户单位:" + szCompany,AFTER); 
 ListAddString(listStartCopy,"程序安装路径:" + szDir,AFTER); 
 ListAddString(listStartCopy,"程序文件夹:" + szfolder,AFTER); 
 ListAddString(listStartCopy,&#

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值