转自http://blog.csdn.net/gaofang2009/article/details/5258446
作者有不少安装包学习心得。值得参考
代码如下:有用的地方要用,但是,要根据实际情况,哦。
至少有些方法可以直接裁出来用的。
有些是我自己编写的,有些是从网上搜来的方法。做一个IS的打包程序还真是不容易呢。
Setup.Rul
- //===========================================================================
- //
- // File Name: Setup.rul
- // Description: Blank setup main script file
- // Comments: Blank setup is an empty setup project. If you want to
- // create a new project via. step-by step instructions use the
- // Project Assistant.
- //描述:空白设置主脚本文件
- // 评论:空白的设置是一个空的安装项目。如果你想通过创建一个新的项目。分步说明使用项目助理
- // Included header files ----------------------------------------------------
- #include "ifx.h"
- BOOL bWinLogin;
- string szServer, szUser, szPassword;
- //---------------------------------------------------------------
- prototype WriteDBInfo(STRING);
- function WriteDBInfo(dbConnection)
- string svResult;
- number nvFileHandle;
- begin
- //写获取连接数据库文件
- OpenFileMode(FILE_MODE_APPEND);
- if (FindFile(ProgramFilesFolder+"//"+@COMPANY_NAME+"//示例数据库","DBConnection.txt", svResult) < 0) then //没有,需要create一个
- CreateFile(nvFileHandle,ProgramFilesFolder+"//"+@COMPANY_NAME+"//示例数据库","DBConnection.txt");
- else
- OpenFile (nvFileHandle ,"DBConnection.txt");
- endif;
- WriteLine( nvFileHandle,dbConnection);
- CloseFile(nvFileHandle);
- end ;
- /////////////////////////////////////////////////////////////////////////////////////////////////
- prototype DetachDB();
- function number DetachDB()
- STRING szCmdLine,szWaitTxt;
- string svResult,svLine;
- begin
- szWaitTxt=" 正在分离安装网站使用的数据库……";
- SdShowMsg (szWaitTxt, TRUE);
- Delay(2);
- //szCmdLine = "/E /S "+svsqlsvr+" /Q /"EXEC sp_detach_db @dbname = N'YCSCMDB'";
- //读取连接字符串
- ottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-style:none; border-right-style:none; border-bottom-style:none; border-left-style:none; border-width:initial; border-color:initial; color:rgb(0, svResult) <0) then
- MessageBox ("数据库配置文件丢失,请手动分离或删除网站使用的数据库!",SEVERE);
- else
- OpenFile ( nvFileHandle ,"DBConnection.txt");
- ab:
- if(GetLine( nvFileHandle,svLine)<0) then
- CloseFile(nvFileHandle);
- else
- szCmdLine =svLine+" /Q /"EXEC sp_detach_db @dbname = N'YCSCMDB'/"";
- //szCmdLine = "/U "+svsqlusr+" /P "+svsqlpwd+" /S "+svsqlsvr+" /Q /"EXEC sp_attach_db @dbname = N'dlbj',@filename1 = N'"+TARGETDIR ^"dlbj_web.MDF',@filename2 = N'"+TARGETDIR ^"dlbmydb_log.LDF'/"";
- LaunchAppAndWait("osql.exe", szCmdLine,WAIT);
- if(LaunchAppAndWait("osql.exe",WAIT)<0) then
- MessageBox ("数据库分离失败!请手动分离或删除网站使用的数据库!",SEVERE);
- goto ab;
- endif;
- endif;
- SdShowMsg (szWaitTxt, FALSE);
- endif;
- //szWaitTxt=" 正在优化系统数据库……";
- //SdShowMsg (szWaitTxt, TRUE);
- //Delay(2);
- //szCmdLine = "/U "+svsqlusr+" /P "+svsqlpwd+" /S "+svsqlsvr+" /Q /"use dlbj ; exec sp_updatestats/"";
- // if (LaunchAppAndWait("osql.exe",WAIT) < 0) then
- // MessageBox ("数据库优化失败!您可以在 SQL查询分析器中执行 use dlbj ; exec sp_updatestats 完成!",SEVERE);
- // endif;
- // SdShowMsg (szWaitTxt, FALSE);
- return 0;
- end;
- //---------------------------------------------------------------------------
- // Note: In order to have your InstallScript function executed as a custom
- // action by the Windows Installer, it must be prototyped as an
- // entry-point function.
- // The keyword export identifies MyFunction() as an entry-point function.
- // The argument it accepts must be a handle to the Installer database.
- /* export prototype MyFunction(HWND); */
- //注意:为了让您的InstallScript中作为一个自定义的执行
- //由Windows Installer的行动,它必须作为一个原型 入口点函数。
- //关键字出口标识调用MyFunction()作为入口点函数。
- //它接受的参数必须是一个句柄安装程序数据库。
- //*出口原型调用MyFunction(HWND); * /
- //-----------------------------------------------------------------------
- prototype CheckIIS(); //检测是否安装了iis
- //--------------------------------------------------------
- //检测是否安装了IIS
- function CheckIIS()
- NUMBER nvType, nvSize;
- STRING svvalue;
- begin
- RegDBSetDefaultRoot ( HKEY_LOCAL_MACHINE );
- if (RegDBKeyExist ("System//CurrentControlSet//Services//IISADMIN" ) = 1) then
- return (1);
- return (0);
- endif;
- end;
- //-----------------------------------------------------------
- //---------------------------------------------------------------------------
- // OnFirstUIBefore
- // The OnFirstUIBefore event is called by the framework when the setup is
- // running in first install mode. By default this event displays UI allowing
- // the end user to specify installation parameters.
- //该事件被称为OnFirstUIBefore由框架时,安装程序
- //运行在第一次安装模式。允许默认情况下此事件显示界面
- //最终用户指定安装参数。
- function OnFirstUIBefore()
- NUMBER nResult, nSetupType, nvSize, nUser;
- STRING szTitle, szMsg, szQuestion, svName, svCompany, szFile;
- STRING szLicenseFile;
- LIST list, listStartcopy;
- BOOL bCustom;
- STRING szBmpPath, szAppPath,svResult,svLine,svSubStr,szIp;//自定义
- number nvFileHandle,nvIp;
- string szOpt1, szOpt2;
- BOOL bLicenseAccepted;
- begin
- // TO DO: if you want to enable background, window title, and caption bar title
- // SetTitle( @PRODUCT_NAME, 24, WHITE );
- ottom:0px!important; margin-left:0px!important; padding-top:0px!important; padding-right:3px!important; padding-bottom:0px!important; padding-left:10px!important; border-top-style:none; border-right-style:none; border-bottom-style:none; border-left-style:solid; border-width:initial; border-color:initial; list-style-type:decimal-leading-zero; list-style-position:outside!important; border-left-width:3px; border-left-color:rgb(108, 0, BACKGROUNDCAPTION );
- // Enable( FULLWINDOWMODE );
- // Enable( BACKGROUND );
- // SetColor(BACKGROUND,RGB (0, 128, 128));
- SHELL_OBJECT_FOLDER = @PRODUCT_NAME;
- nSetupType = TYPICAL;
- //-----------------------------------------------------------------------
- //设置背景图片
- SetTitle("欢迎您使用银河卡电子产品", 24, WHITE);
- SetTitle( "安装“网上阅卷系统”",BACKGROUNDCAPTION);
- Enable(FULLWINDOWMODE);
- Enable(BACKGROUND );
- // PlaceBitmap (SUPPORTDIR^"BackGround.bmp",UPPER_LEFT); //左上角显示图片
- ottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-style:none; border-right-style:none; border-bottom-style:none; border-left-style:none; border-width:initial; border-color:initial; color:rgb(0,FULLSCREENSIZE); //全屏显示图片
- //PlaceWindow ( BILLBOARD , 200 , 40 , UPPER_LEFT ); //平铺logo
- //SetdisplayEffect(EFF_FADE);//设置显示效果
- // PlaceWindow ( BILLBOARD , 200 , 40 , UPPER_LEFT );
- //PlaceWindow(BACKGROUND,10,UPPER_LEFT); //背景窗口的位置为左上方开始10,10
- SetColor(BACKGROUND,RGB (0, 128, 128));
- //----------------------------------------------------------------
- //----------------------------------------------------------------
- szBmpPath=SUPPORTDIR+"//left.bmp;1;0,0"; //图片有白色的背景,所以设置白色为透明色 “位图文件名;透明标志;<未用>;<未用>;透明色”标准位图为57×53
- //SizeWindow (MetaFILE,50, 50);
- DialogSetInfo (DLG_INFO_ALtimage, szBmpPath,TRUE); // 设置左边的logo图片
- //------------------------------------------------------------------
- //------------------------------------------------------------------
- SdShowMsg( "安装程序正在检测系统必备组件...... ",TRUE);
- Delay(2);
- SdShowMsg ("",FALSE);
- //---------------------------------------------------------------------
- WriteIp:
- //写获取ip地址文件
- if (FindFile(SUPPORTDIR,"ipconfig.bat", svResult) < 0) then //没有,需要create一个
- ottom:0px!important; margin-left:0px!important; padding-top:0px!important; padding-right:3px!important; padding-bottom:0px!important; padding-left:10px!important; border-top-style:none; border-right-style:none; border-bottom-style:none; border-left-style:solid; border-width:initial; border-color:initial; list-style-type:decimal-leading-zero; list-style-position:outside!important; border-left-width:3px; border-left-color:rgb(108,SUPPORTDIR,"ipconfig.bat");
- OpenFile ( nvFileHandle ,"ipconfig.bat");
- //LaunchAppAndWait("","net stop w3svc"+"/S",WAIT);
- WriteLine( nvFileHandle,"ipconfig /all >> /""+SUPPORTDIR+"/ipconfig.txt/"");
- CloseFile(nvFileHandle);
- LaunchAppAndWait("",SUPPORTDIR^"ipconfig.bat",WAIT);
- //----------------------------------------------------------------------------------
- //读取ip地址
- if (FindFile( SUPPORTDIR,"ipconfig.txt",0); background-color:inherit">//没有,需要create一个
- goto WriteIp;
- else
- ottom:0px!important; margin-left:0px!important; padding-top:0px!important; padding-right:3px!important; padding-bottom:0px!important; padding-left:10px!important; border-top-style:none; border-right-style:none; border-bottom-style:none; border-left-style:solid; border-width:initial; border-color:initial; list-style-type:decimal-leading-zero; list-style-position:outside!important; border-left-width:3px; border-left-color:rgb(108,"ipconfig.txt");
- endif;
- ab:
- ottom:0px!important; margin-left:0px!important; padding-top:0px!important; padding-right:3px!important; padding-bottom:0px!important; padding-left:10px!important; border-top-style:none; border-right-style:none; border-bottom-style:none; border-left-style:solid; border-width:initial; border-color:initial; list-style-type:decimal-leading-zero; list-style-position:outside!important; border-left-width:3px; border-left-color:rgb(108,svLine)<0) then
- CloseFile(nvFileHandle);
- else
- nvIp=StrFind(svLine,"Ethernet adapter 本地连接:");
- if(nvIp>-1)then
- cd:
- CloseFile(nvFileHandle);
- nvIp=StrFind (svLine,"IP Address");
- StrSub (svSubStr, svLine,nvIp+StrLength("IP Address. . . . . . . . . . . . : "), StrLength (svLine)-nvIp+StrLength("IP Address. . . . . . . . . . . . : "));
- szIp=svSubStr;
- goto cd;
- endif;
- endif;
- goto ab;
- endif;
- endif;
- //--------------------------------------------------------------------------------------
- SetIIS:
- //安装iis
- //szProgram = "rundll32.exe";
- //szCmdLine = "setupapi.dll,InstallHinfSection Modem1 132 " + WINDIR + "driver139//oxser.inf";
- if CheckIIS() then
- goto SetDotNet;
- else
- SprintfBox(MB_OK,"IIS安装","您还未安装IIS,请安装!");
- if(LaunchAppAndWait("rundll32.exe", "shell32.dll,Control_RunDLL appwiz.cpl,2", WAIT)<0)then
- SprintfBox(MB_OK,"IIS安装时发生意外,请重新安装!");
- goto SetIIS;
- endif;
- SetDotNet:
- //判断是否安装了.netframework
- RegDBSetDefaultRoot ( HKEY_LOCAL_MACHINE );
- if ( RegDBKeyExist ("SOFTWARE//Microsoft//.NETFramework//policy//v2.0" ) < 0) then
- SprintfBox(MB_OK,".NET安装","尚未安装.net framework 2.0 !/n请点击“确定”以继续安装!");
- if( LaunchAppAndWait( SUPPORTDIR ^ "dotnetfx.exe" , "/q:a/l" ,WAIT) < 0) then
- SprintfBox(MB_OK,"安装.net框架时发生意外,请重新安装!");
- ottom:0px!important; margin-left:0px!important; padding-top:0px!important; padding-right:3px!important; padding-bottom:0px!important; padding-left:10px!important; border-top-style:none; border-right-style:none; border-bottom-style:none; border-left-style:solid; border-width:initial; border-color:initial; list-style-type:decimal-leading-zero; list-style-position:outside!important; border-left-width:3px; border-left-color:rgb(108,".NET FrameWork 2.0已安装!");
- endif;
- //----------------------------------------------------------------------
- SetsqlServer:
- //判断是否安装了sql Server
- if ( RegDBSetkeyvalueEx ("SOFTWARE//Microsoft//Microsoft sql Server//80//MSsqlLicenseInfo//MSsql8.00//displayName","displayName",REGDB_STRING,"sql Server 2000",-1 ) < 0) then
- ottom:0px!important; margin-left:0px!important; padding-top:0px!important; padding-right:3px!important; padding-bottom:0px!important; padding-left:10px!important; border-top-style:none; border-right-style:none; border-bottom-style:none; border-left-style:solid; border-width:initial; border-color:initial; list-style-type:decimal-leading-zero; list-style-position:outside!important; border-left-width:3px; border-left-color:rgb(108,"sql Server 2000 安装","尚未安装sql Server 2000 !/n请点击“确定”以继续安装!");
- if( LaunchAppAndWait( SUPPORTDIR ^ "sql 2000 Enterprise//AUTORUN.EXE.exe" ,"安装sql Server 2000 时发生意外,248); line-height:24px"> SprintfBox(MB_OK,"sql Server 2000 已安装!");
- endif;
- endif;
- //------------------------------------------------------------------
- Dlg_SdWelcome: //欢迎 对话框
- szTitle = "欢迎使用YHK_GF安装软件";
- szMsg = "YHK_GF安装软件将在您的计算机中安装/b/n/b/n“网上阅卷系统”,/b/n/b/n若要继续,请单击“下一步”。";
- nResult = SdWelcome(szTitle, szMsg);
- if (nResult = BACK) goto Dlg_SdWelcome;
- Dlg_SdLicense2: //软件许可协议
- szTitle ="欢迎您/b/n请仔细阅读用户协议,本协议具有法律效力!!";
- szOpt1 = "同意(&A)";
- szOpt2 = "不同意(&D)";
- //{{IS_SCRIPT_TAG(License_File_Path)
- szLicenseFile = SUPPORTDIR ^ "用户使用协议.rtf";
- //}}IS_SCRIPT_TAG(License_File_Path)
- //{{IS_SCRIPT_TAG(Dlg_SdLicense2)
- nResult = SdLicense2Rtf( szTitle, szOpt1, szOpt2, szLicenseFile, bLicenseAccepted );
- //}}IS_SCRIPT_TAG(Dlg_SdLicense2)
- if (nResult = BACK) then
- goto Dlg_SdWelcome;
- bLicenseAccepted = TRUE;
- Dlg_SdCustomer@R_686_4045@ion:
- //用户信息对话框
- szMsg = "请您填写用户信息卡";
- szTitle = "欢迎您/b/n使用YHK安装系统";
- svName = "";
- svCompany = "";
- nResult = SdCustomer@R_686_4045@ion(szTitle, nUser);
- Dlg_SetupType: //安装类型对话框
- szTitle = "安装类型/b/n请选择安装类型";
- szMsg = "请选择安装";
- nResult = SetupType(szTitle, "", 0);
- if (nResult = BACK) then
- goto Dlg_SdCustomer@R_686_4045@ion;
- nSetupType = nResult;
- if (nSetupType != CUSTOM) then
- nvSize = 0;
- FeatureCompareSizerequired(MEDIA, INSTALLDIR, nvSize);
- if (nvSize != 0) then
- MessageBox(szSdStr_NotEnoughSpace, WARNING);
- goto Dlg_SetupType;
- endif;
- bCustom = FALSE;
- goto Dlg_sql;
- bCustom = TRUE;
- endif;
- Dlg_SdaskDestPath:
- szTitle="";
- szMsg="";
- nResult = SdaskDestPath(szTitle, 0);
- goto Dlg_SetupType;
- Dlg_SdFeatureTree:
- szTitle = "";
- szMsg = "";
- if (nSetupType = CUSTOM) then
- nResult = SdFeatureTree(szTitle, 2);
- goto Dlg_SdaskDestPath;
- endif;
- Dlg_sql:
- nResult = OnsqlLogin( nResult );
- if( nResult = BACK ) then
- if (!bCustom) then
- goto Dlg_SetupType;
- goto Dlg_SdFeatureTree;
- Dlg_SdStartcopy: //准备就绪对话框
- szTitle = "可以安装“网上阅卷系统”了/b/n安装准备工作已就绪,可以开始安装了。";
- szMsg ="";// "单击“安装”以开始安装。/b/n如果要检查或更改任何安装设置,请单击“上一步”。单击“取消”退出安装向导。";
- listStartcopy = ListCreate( STRINGLIST );
- //The following is an example of how to add a string(svName) to a list(listStartcopy).
- //eg. ListAddString(listStartcopy,svName,AFTER);
- ListAddString(listStartcopy,"你的选择如下:",AFTER);
- ListAddString(listStartcopy,"",AFTER);
- ottom:0px!important; margin-left:0px!important; padding-top:0px!important; padding-right:3px!important; padding-bottom:0px!important; padding-left:10px!important; border-top-style:none; border-right-style:none; border-bottom-style:none; border-left-style:solid; border-width:initial; border-color:initial; list-style-type:decimal-leading-zero; list-style-position:outside!important; border-left-width:3px; border-left-color:rgb(108,"安装路径:"+TARGETDIR,"程序组名:"+SHELL_OBJECT_FOLDER,248); line-height:24px"> ListAddString(listStartcopy,"安装类型:"+"自定义",108); color:inherit; line-height:24px"> elseif (nSetupType = TYPICAL) then
- ottom:0px!important; margin-left:0px!important; padding-top:0px!important; padding-right:3px!important; padding-bottom:0px!important; padding-left:10px!important; border-top-style:none; border-right-style:none; border-bottom-style:none; border-left-style:solid; border-width:initial; border-color:initial; list-style-type:decimal-leading-zero; list-style-position:outside!important; border-left-width:3px; border-left-color:rgb(108,"安装类型:"+"典型",108); color:inherit; line-height:24px"> elseif (nSetupType = COMPACT) then
- ottom:0px!important; margin-left:0px!important; padding-top:0px!important; padding-right:3px!important; padding-bottom:0px!important; padding-left:10px!important; border-top-style:none; border-right-style:none; border-bottom-style:none; border-left-style:solid; border-width:initial; border-color:initial; list-style-type:decimal-leading-zero; list-style-position:outside!important; border-left-width:3px; border-left-color:rgb(108,"安装类型:"+"压缩",248); line-height:24px"> nResult = SdStartcopy( szTitle, listStartcopy );
- ListDestroy(listStartcopy);
- goto Dlg_sql;
- //---------------------------------------------------------------------------------
- // 在桌面上添加快捷方式
- AddFolderIcon(FOLDER_DESKTOP,"网上阅卷系统首页","/"http://"+szIp+":8080/Default.aspx/"",TARGETDIR,TARGETDIR+"//TempIco//021.ico","",REPLACE);
- //添加程序快捷方式
- AddFolderIcon(FOLDER_PROGRAMS^"网上阅卷系统GF安装","网上阅卷系统首页",0); background-color:inherit">//添加卸载快捷方式
- ottom:0px!important; margin-left:0px!important; padding-top:0px!important; padding-right:3px!important; padding-bottom:0px!important; padding-left:10px!important; border-top-style:none; border-right-style:none; border-bottom-style:none; border-left-style:solid; border-width:initial; border-color:initial; list-style-type:decimal-leading-zero; list-style-position:outside!important; border-left-width:3px; border-left-color:rgb(108,"卸载","/""+PROGRAMFILES+"/InstallShield Installation @R_686_4045@ion//{E71A5501-0CCF-4765-A743-8F1352781170}//Setup.exe /"",TARGETDIR+"//TempIco//011.ico",0); background-color:inherit">// <PROGRAMFILES>/InstallShield Installation @R_686_4045@ion/{96C6BC6D-1EAA-43C2-9A2C-CB1242590FD7}/Setup.exe
- // 其中
- // {611b4a59-fae0-443b-acbb-8cb1ce57fada}
- // 这个值是这样取得的
- // Project-》Setting-》General-》Project对应的那项
- //---------------------------------------------------------------------------------------------------------------
- // setup default status
- Enable(STATUSEX);
- return 0;
- end;
- // OnMaintUIAfter
- //
- // The OnMaintUIAfter event called by the framework after the file transfer
- // of the setup when the setup is running in maintenance mode. By default
- // this event displays UI that informs the end user that the maintenance setup
- // has been completed successfully.
- //事件的OnMaintUIAfter所呼吁的框架后,文件传输在安装时,安装程序在维护模式下运行。
- //默认情况下 这一事件显示界面,通知最终用户,维修安装 已成功完成。...
- function OnMaintUIAfter()
- ottom:0px!important; margin-left:0px!important; padding-top:0px!important; padding-right:3px!important; padding-bottom:0px!important; padding-left:10px!important; border-top-style:none; border-right-style:none; border-bottom-style:none; border-left-style:solid; border-width:initial; border-color:initial; list-style-type:decimal-leading-zero; list-style-position:outside!important; border-left-width:3px; border-left-color:rgb(108, szMsg1, szMsg2, szOption1, szOption2;
- NUMBER bOpt1, bOpt2;
- disable(STATUSEX);
- bOpt1 = FALSE;
- bOpt2 = FALSE;
- // Added - Version 9.5 - Use appropriate strings for complete
- // uninstall.
- if( REMOVEALLMODE ) then
- szTitle = SdLoadString(IFX_SDFINISH_REMOVE_TITLE);
- szMsg1 = SdLoadString(IFX_SDFINISH_REMOVE_MSG1);
- //卸载完成
- szTitle="卸载完毕";
- szMsg1="已完全卸载“网上阅卷系统”";
- szTitle = SdLoadString(IFX_SDFINISH_MAINT_TITLE);
- szMsg1 = SdLoadString(IFX_SDFINISH_MAINT_MSG1);
- szMsg2 ="谢谢您使用保定银河卡电子公司的产品。";
- SdFinishEx(szTitle, szOption2, bOpt1, bOpt2);
- end;
- // OnFirstUIAfter
- // The OnFirstUIAfter event called by the framework after the file transfer
- // of the setup when the setup is running in first install mode. By default
- // this event displays UI that informs the end user that the setup has been
- // completed successfully.
- //事件的OnFirstUIAfter后调用文件transferof安装时,安装程序在第一次安装模式下运行的框架。
- //默认情况下此事件显示界面,通知最终用户,安装程序已成功完成。
- function OnFirstUIAfter()
- STRING szTitle, szOption2;
- NUMBER bOpt1, bOpt2;
- string szBmpPath;//自定义
- begin
- szBmpPath=SUPPORTDIR+"//left.bmp;1;0,0";
- DialogSetInfo (DLG_INFO_ALtimage,0); background-color:inherit">// 设置左边的图片
- disable(STATUSEX);
- //---------------------------------------
- //安装完成之时
- szTitle = "阅卷系统安装完毕";
- szMsg1 = "谢谢您使用YHK_GF安装程序!!";
- szMsg2 = "已成功安装网“网上阅卷系统”,请单击“完成”以退出安装向导。";
- bOpt1 = FALSE;
- bOpt2 = FALSE;
- szMsg1 = SdLoadString(IFX_SDFINISH_MSG1);
- SdFinishEx(szTitle, bOpt2);
- // OnsqlLogin
- function number OnsqlLogin( nBtn )
- string sMessage;
- string szConnection,szDB, stemp[MAX_PATH]; // szServer, szPassword,
- number nResult, nSize, nCount;
- BOOL bNext; //bWinLogin,108); color:inherit; line-height:24px"> LIST listConnections;
- STRING svResult,svLine;//自定义
- number nvFileHandle;
- //First initialize sql Server runtime
- //第一初始化的sql Server运行
- sqlRtinitialize2();
- // Suppress ISsqlSRV.DLL to show a connection error message.
- //禁止ISsqlSRV.DLL显示连接错误信息
- MsiSetProperty( ISMSI_HANDLE, "IS_sqlSERVER_CA_SILENT", "1" );
- //Get the names of all the necessary connections
- listConnections = sqlRTGetConnections();
- ListGetFirstString (listConnections, szConnection);
- nCount = 0;
- //determine if NEXT or BACK will be returned
- //if there are no connections to make
- //确定下一个或返回将被退回
- //如果没有连接
- if( nBtn != BACK ) then
- bNext = TRUE;
- bNext = FALSE;
- //start at end if going BACK
- //退回
- while (ISERR_SUCCESS = ListGetNextString( listConnections, szConnection ) );
- nCount++;
- endwhile;
- // Login for each connection
- //登录每个连接
- while (nResult = ISERR_SUCCESS)
- //Get Default values for connection
- //获得连接字符串
- sqlRTGetConnectionInfo( szConnection, szServer, szDB, szPassword );
- bWinLogin = sqlRTGetConnectionAuthentication( szConnection );
- // display login dialog (without connection name)
- //显示登录对话框没有连接名称
- // COMMENT OUT TO SWAP DIALOGS
- //注释外部全系统计划的对话
- nResult = sqlServerSelectLogin2( szConnection, bWinLogin, FALSE, TRUE );
- //下面的是只显示 登录用户和密码的不显示数据库和windows登录选择
- //nResult = sqlServerLogin( "", szPassword );
- // display login dialog (with connection name)
- //显示登录对话框没有连接名称
- // UNCOMMENT TO SWAP DIALOGS
- //注释外部全系统计划的对话
- // nResult = sqlServerSelectLogin2( szConnection, TRUE, TRUE );
- if( nResult = NEXT ) then
- //store data in case we need it again
- //保存数据库配置信息,以备下次需要
- sqlRTPutConnectionInfo2( szConnection, szPassword );
- sqlRTPutConnectionAuthentication( szConnection, bWinLogin );
- //test connection
- //测试连接
- nResult = sqlRTTestConnection2( szConnection,108); color:inherit; line-height:24px"> nSize = MAX_PATH;
- MsiGetProperty( ISMSI_HANDLE, "IS_sqlSERVER_STATUS", stemp, nSize );
- if( stemp != "0" ) then
- nSize = _MAX_PATH;
- MsiGetProperty( ISMSI_HANDLE, "IS_sqlSERVER_STATUS_ERROR", sMessage, nSize );
- if( nSize = 0 ) then
- Sprintf(sMessage, SdLoadString( IDS_IFX_sql_ERROR_LOGIN_Failed ), szConnection, SdLoadString( ISCRIPT_E_UNKNowN_ERROR_DESC ));
- endif;
- MessageBox( sMessage, MB_OK );
- //Show same login dialog again
- //显示相同的数据库登录对话框
- nResult = ListCurrentString(listConnections, szConnection);
- else //SUCCESS
- //成功
- //继续下一个连接
- //Move on to next connection
- nCount++;
- bNext = TRUE;
- nResult = ListGetNextString(listConnections,248); line-height:24px"> // MsiSetProperty
- //设置Property里的值
- (ISMSI_HANDLE,"Connection_Property","server="+szServer+";database=wxd;uid="+szUser+";pwd="+szPassword);
- //BACK
- //回退
- nCount--;
- bNext = FALSE;
- nResult = ListSetIndex( listConnections, nCount );
- ListCurrentString( listConnections, szConnection );
- endwhile;
- if( bNext ) then
- return NEXT;
- return BACK;
- end;
- // OnMaintUIBefore
- // The OnMaintUIBefore event is called by the framework when the setup is
- // running in maintenance mode. By default this event displays UI that
- // allows the end user to add or remove features, repair currently
- // installed features or uninstall the application.
- //该事件被称为OnMaintUIBefore由框架时,安装程序 在维护模式下运行。
- //默认情况下此事件显示界面, 允许最终用户添加或删除功能,目前维修 安装的功能或卸载应用程序。
- function OnMaintUIBefore()
- ottom:0px!important; margin-left:0px!important; padding-top:0px!important; padding-right:3px!important; padding-bottom:0px!important; padding-left:10px!important; border-top-style:none; border-right-style:none; border-bottom-style:none; border-left-style:solid; border-width:initial; border-color:initial; list-style-type:decimal-leading-zero; list-style-position:outside!important; border-left-width:3px; border-left-color:rgb(108, nType;
- ottom:0px!important; margin-left:0px!important; padding-top:0px!important; padding-right:3px!important; padding-bottom:0px!important; padding-left:10px!important; border-top-style:none; border-right-style:none; border-bottom-style:none; border-left-style:solid; border-width:initial; border-color:initial; list-style-type:decimal-leading-zero; list-style-position:outside!important; border-left-width:3px; border-left-color:rgb(108, svDir, svResult, szCaption;
- //自定义
- STRING szBmpPath;
- SetTitle("欢迎您使用银河卡电子公司的软件", BACKGROUNDCAPTION );//设置标题
- ottom:0px!important; margin-left:0px!important; padding-top:0px!important; padding-right:3px!important; padding-bottom:0px!important; padding-left:10px!important; border-top-style:none; border-right-style:none; border-bottom-style:none; border-left-style:solid; border-width:initial; border-color:initial; list-style-type:decimal-leading-zero; list-style-position:outside!important; border-left-width:3px; border-left-color:rgb(108, and caption bar title
- //如果你要启用的背景,窗口标题,标题和标题栏
- ottom:0px!important; margin-left:0px!important; padding-top:0px!important; padding-right:3px!important; padding-bottom:0px!important; padding-left:10px!important; border-top-style:none; border-right-style:none; border-bottom-style:none; border-left-style:solid; border-width:initial; border-color:initial; list-style-type:decimal-leading-zero; list-style-position:outside!important; border-left-width:3px; border-left-color:rgb(108, WHITE );
- ottom:0px!important; margin-left:0px!important; padding-top:0px!important; padding-right:3px!important; padding-bottom:0px!important; padding-left:10px!important; border-top-style:none; border-right-style:none; border-bottom-style:none; border-left-style:solid; border-width:initial; border-color:initial; list-style-type:decimal-leading-zero; list-style-position:outside!important; border-left-width:3px; border-left-color:rgb(108, BACKGROUNDCAPTION );
- ottom:0px!important; margin-left:0px!important; padding-top:0px!important; padding-right:3px!important; padding-bottom:0px!important; padding-left:10px!important; border-top-style:none; border-right-style:none; border-bottom-style:none; border-left-style:solid; border-width:initial; border-color:initial; list-style-type:decimal-leading-zero; list-style-position:outside!important; border-left-width:3px; border-left-color:rgb(108, 128));
- // Enable( FULLWINDOWMODE );
- // Enable( BACKGROUND );
- Dlg_Start:
- //----------------------------------------------------------------
- //此处为第二次是卸载
- svResult = SdLoadString(IFX_MAINTUI_MSG);
- szCaption = SdLoadString(IFX_ONMAINTUI_CAPTION);
- svResult="是否要完全卸载“网上阅卷系统”?";
- szCaption="确认卸载";
- nResult = SprintfBox(MB_OKCANCEL,szCaption,"%s",svResult);
- if (nResult = IDCANCEL) then
- exit;
- elseif(nResult = IDOK) then
- // setup default status
- SetStatusWindow(0, "");
- Enable(STATUSEX);
- StatusUpdate(ON, 100);
- //-->Remove all components
- ComponentRemoveAll();
- //-------------------------------------------------------------------------------------------
- //分离数据库EXEC sp_detach_db @dbname = '数据库名称'
- //Server=[IS_sqlSERVER_SERVER];User id=[IS_sqlSERVER_USERNAME];Pwd=[IS_sqlSERVER_PASSWORD];DataBase=wxd;Max Pool Size=200;Connect Timeout=300;Connection Lifetime=3;
- //DetachDB();
- //-----------------------------------------------------------------------------------------------------
- //----------------------------------------------------------------------------
- DeleteDir(TARGETDIR,ALLCONTENTS);
- DeleteDir(TARGETDIR,ONLYDIR);
- //---------------------------------------------------------------------
- endif;
- return 0;
- //------------------------------------------------------------
- // Added in Version 9.5 - Support for REMOVEONLY option.
- //新增的版本9.5 - 为REMOVEONLY选择支持
- if( !REMOVEONLY ) then
- // In standard mode show maintenance dialog
- //在标准模式对话框显示维修
- disable(BACKBUTTON);
- nType = SdWelcomeMaint(szTitle, MODIFY);
- Enable(BACKBUTTON);
- // Hide the initial progress dialog as otherwise the user can
- // click on it, and hide the MessageBox.
- //隐藏,否则用户的对话,可以初步进展点击它,并隐藏在MessageBox。
- disable( DIALOGCACHE );
- // In RemoveOnly mode, set to remove.
- //在RemoveOnly模式,设置删除
- nType = REMOVEALL;
- // Show Uninstall Confirmation Dialog
- //显示卸载确认对话框
- if ( nType = REMOVEALL ) then
- nResult = MessageBox( SdLoadString( IFX_MAINTUI_MSG ), MB_YESNO );
- if (nResult != IDYES ) then
- if( REMOVEONLY ) then
- // In REMOVEONLY mode, abort the setup.
- //显示卸载确认对话框
- abort;
- // In non-REMOVEONLY mode, redisplay the prevIoUs dialog.
- //在非REMOVEONLY模式,重新显示以前的对话。
- goto Dlg_Start;
- nResult = NEXT;
- Dlg_SdFeatureTree:
- if (nType = MODIFY) then
- szTitle = "";
- szMsg = "";
- nResult = SdFeatureTree(szTitle, 2);
- goto Dlg_Start;
- endif;
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。