微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

InsallShield 脚本模板代码

转自http://blog.csdn.net/gaofang2009/article/details/5258446

作者有不少安装包学习心得。值得参考


代码如下:有用的地方要用,但是,要根据实际情况,哦。

至少有些方法可以直接裁出来用的。

有些是我自己编写的,有些是从网上搜来的方法。做一个IS的打包程序还真是不容易呢。

Setup.Rul

  1. //===========================================================================  
  2. //  
  3. //  File Name:    Setup.rul  
  4. //  Description:  Blank setup main script file  
  5. //  Comments:     Blank setup is an empty setup project. If you want to  
  6. //                create a new project via. step-by step instructions use the  
  7. //                Project Assistant.  
  8. //描述:空白设置主脚本文件  
  9. // 评论:空白的设置是一个空的安装项目。如果你想通过创建一个新的项目。分步说明使用项目助理  
  10.   
  11. // Included header files ----------------------------------------------------  
  12. #include "ifx.h"  
  13.    BOOL bWinLogin;     
  14.    string szServer, szUser, szPassword;   
  15.    //---------------------------------------------------------------   
  16. prototype  WriteDBInfo(STRING);  
  17. function  WriteDBInfo(dbConnection)       
  18.     string svResult;     
  19.     number nvFileHandle;  
  20. begin  
  21.   
  22.  //写获取连接数据库文件  
  23.     OpenFileMode(FILE_MODE_APPEND);   
  24. if (FindFile(ProgramFilesFolder+"//"+@COMPANY_NAME+"//示例数据库","DBConnection.txt", svResult) < 0) then //没有,需要create一个   
  25.         CreateFile(nvFileHandle,ProgramFilesFolder+"//"+@COMPANY_NAME+"//示例数据库","DBConnection.txt");   
  26. else   
  27.         OpenFile (nvFileHandle ,"DBConnection.txt");     
  28.     endif;   
  29.     WriteLine( nvFileHandle,dbConnection);   
  30.     CloseFile(nvFileHandle);   
  31. end ;  
  32. /////////////////////////////////////////////////////////////////////////////////////////////////  
  33. prototype DetachDB();  
  34. function number DetachDB()   
  35.     STRING szCmdLine,szWaitTxt;   
  36. string svResult,svLine;     
  37. begin       
  38.     szWaitTxt=" 正在分离安装网站使用的数据库……";   
  39.     SdShowMsg (szWaitTxt, TRUE);   
  40.     Delay(2);      
  41.     //szCmdLine = "/E  /S "+svsqlsvr+" /Q /"EXEC  sp_detach_db  @dbname  =  N'YCSCMDB'";   
  42.     //读取连接字符串    
  43.     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   
  44.        MessageBox ("数据库配置文件丢失,请手动分离或删除网站使用的数据库!",SEVERE);   
  45. else  
  46.         OpenFile ( nvFileHandle ,"DBConnection.txt");      
  47.         ab:  
  48.         if(GetLine( nvFileHandle,svLine)<0) then   
  49.             CloseFile(nvFileHandle);  
  50.          else  
  51.                 szCmdLine =svLine+" /Q /"EXEC  sp_detach_db  @dbname  =  N'YCSCMDB'/"";   
  52.                 //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'/"";   
  53.                 LaunchAppAndWait("osql.exe", szCmdLine,WAIT);  
  54.                 if(LaunchAppAndWait("osql.exe",WAIT)<0)  then  
  55.                       MessageBox ("数据库分离失败!请手动分离或删除网站使用的数据库!",SEVERE);    
  56.                                            goto ab;  
  57.                 endif;   
  58.         endif;  
  59.         SdShowMsg (szWaitTxt, FALSE);         
  60.     endif;   
  61. //szWaitTxt=" 正在优化系统数据库……";   
  62. //SdShowMsg (szWaitTxt, TRUE);   
  63. //Delay(2);   
  64. //szCmdLine = "/U "+svsqlusr+" /P "+svsqlpwd+" /S "+svsqlsvr+" /Q /"use dlbj ; exec sp_updatestats/"";   
  65. //  if (LaunchAppAndWait("osql.exe",WAIT) < 0) then   
  66. //  MessageBox ("数据库优化失败!您可以在 SQL查询分析器中执行 use dlbj ; exec sp_updatestats 完成!",SEVERE);   
  67. //  endif;   
  68. //  SdShowMsg (szWaitTxt, FALSE);    
  69.       
  70. return 0;   
  71. end;   
  72. //---------------------------------------------------------------------------  
  73.      
  74. // Note: In order to have your InstallScript function executed as a custom  
  75. // action by the Windows Installer, it must be prototyped as an   
  76. // entry-point function.  
  77. // The keyword export identifies MyFunction() as an entry-point function.  
  78. // The argument it accepts must be a handle to the Installer database.  
  79. /* export prototype MyFunction(HWND); */  
  80. //注意:为了让您的InstallScript中作为一个自定义的执行   
  81. //由Windows Installer的行动,它必须作为一个原型 入口点函数。   
  82. //关键字出口标识调用MyFunction()作为入口点函数。   
  83. //它接受的参数必须是一个句柄安装程序数据库。   
  84.        
  85. //*出口原型调用MyFunction(HWND); * /  
  86.       //-----------------------------------------------------------------------  
  87. prototype CheckIIS(); //检测是否安装了iis      
  88. //--------------------------------------------------------    
  89. //检测是否安装了IIS  
  90. function CheckIIS()   
  91.     NUMBER nvType, nvSize;   
  92.     STRING svvalue;   
  93.     begin   
  94.         RegDBSetDefaultRoot ( HKEY_LOCAL_MACHINE );   
  95. if (RegDBKeyExist ("System//CurrentControlSet//Services//IISADMIN" ) = 1) then   
  96.                 return (1);   
  97.             return (0);   
  98.         endif;  
  99.     end;   
  100. //-----------------------------------------------------------   
  101.        
  102. //---------------------------------------------------------------------------  
  103. // OnFirstUIBefore  
  104. // The OnFirstUIBefore event is called by the framework when the setup is  
  105. // running in first install mode. By default this event displays UI allowing  
  106. // the end user to specify installation parameters.  
  107. //该事件被称为OnFirstUIBefore由框架时,安装程序  
  108. //运行在第一次安装模式。允许认情况下此事件显示界面  
  109. //最终用户指定安装参数。  
  110. function OnFirstUIBefore()  
  111.     NUMBER nResult, nSetupType, nvSize, nUser;  
  112.     STRING szTitle, szMsg, szQuestion, svName, svCompany, szFile;  
  113.     STRING szLicenseFile;    
  114.       
  115.     LIST list, listStartcopy;  
  116.     BOOL bCustom;     
  117.     STRING szBmpPath, szAppPath,svResult,svLine,svSubStr,szIp;//自定义       
  118.     number nvFileHandle,nvIp;      
  119. string szOpt1, szOpt2;      
  120.     BOOL bLicenseAccepted;  
  121. begin     
  122. // TO DO: if you want to enable background, window title, and caption bar title                                                                     
  123. // SetTitle( @PRODUCT_NAME, 24, WHITE );                                          
  124. 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 );                         
  125. // Enable( FULLWINDOWMODE );                             
  126. // Enable( BACKGROUND );                                
  127. // SetColor(BACKGROUND,RGB (0, 128, 128));                       
  128.     SHELL_OBJECT_FOLDER = @PRODUCT_NAME;         
  129.     nSetupType = TYPICAL;     
  130. //-----------------------------------------------------------------------  
  131. //设置背景图片   
  132.       SetTitle("欢迎您使用银河卡电子产品",   24,   WHITE);                                                                                     
  133.           SetTitle( "安装“网上阅卷系统”",BACKGROUNDCAPTION);                                             
  134.           Enable(FULLWINDOWMODE);           
  135.           Enable(BACKGROUND );         
  136.          // PlaceBitmap   (SUPPORTDIR^"BackGround.bmp",UPPER_LEFT);  //左上角显示图片  
  137.          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);   //全屏显示图片  
  138. //PlaceWindow ( BILLBOARD , 200 , 40 , UPPER_LEFT ); //平铺logo   
  139. //SetdisplayEffect(EFF_FADE);//设置显示效果     
  140. // PlaceWindow   (   BILLBOARD   ,   200   ,   40   ,   UPPER_LEFT   );    
  141. //PlaceWindow(BACKGROUND,10,UPPER_LEFT); //背景窗口的位置为左上方开始10,10    
  142.           SetColor(BACKGROUND,RGB   (0,   128,   128));   
  143. //----------------------------------------------------------------     
  144. //----------------------------------------------------------------     
  145. szBmpPath=SUPPORTDIR+"//left.bmp;1;0,0";  //图片有白色的背景,所以设置白色为透明色  “位图文件名;透明标志;<未用>;<未用>;透明色”标准位图为57×53  
  146. //SizeWindow (MetaFILE,50, 50);     
  147. DialogSetInfo (DLG_INFO_ALtimage, szBmpPath,TRUE); // 设置左边的logo图片   
  148. //------------------------------------------------------------------     
  149. //------------------------------------------------------------------     
  150. SdShowMsg( "安装程序正在检测系统必备组件...... ",TRUE);   
  151. Delay(2);       
  152. SdShowMsg   ("",FALSE);      
  153. //---------------------------------------------------------------------  
  154.  WriteIp:  
  155. //写获取ip地址文件  
  156. if (FindFile(SUPPORTDIR,"ipconfig.bat", svResult) < 0) then //没有,需要create一个   
  157. 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");   
  158.         OpenFile ( nvFileHandle ,"ipconfig.bat");     
  159.         //LaunchAppAndWait("","net stop w3svc"+"/S",WAIT);  
  160.     WriteLine( nvFileHandle,"ipconfig /all >> /""+SUPPORTDIR+"/ipconfig.txt/"");   
  161.     CloseFile(nvFileHandle);    
  162.       LaunchAppAndWait("",SUPPORTDIR^"ipconfig.bat",WAIT);    
  163.  //----------------------------------------------------------------------------------  
  164. //读取ip地址  
  165. if (FindFile( SUPPORTDIR,"ipconfig.txt",0); background-color:inherit">//没有,需要create一个   
  166.        goto WriteIp;  
  167. else   
  168. 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");     
  169.     endif;    
  170.     ab:  
  171. 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   
  172.         CloseFile(nvFileHandle);  
  173.         else    
  174.         nvIp=StrFind(svLine,"Ethernet adapter 本地连接:");  
  175. if(nvIp>-1)then    
  176.                     cd:  
  177.                                              CloseFile(nvFileHandle);  
  178.                         nvIp=StrFind (svLine,"IP Address");  
  179.                                                      StrSub (svSubStr, svLine,nvIp+StrLength("IP Address. . . . . . . . . . . . : "), StrLength (svLine)-nvIp+StrLength("IP Address. . . . . . . . . . . . : "));   
  180.                            szIp=svSubStr;  
  181.                                                       goto cd;   
  182.                          endif;   
  183.                     endif;    
  184.              goto ab;   
  185.          endif;    
  186.     endif;  
  187. //--------------------------------------------------------------------------------------  
  188. SetIIS:  
  189. //安装iis    
  190. //szProgram = "rundll32.exe";   
  191. //szCmdLine = "setupapi.dll,InstallHinfSection Modem1 132 " + WINDIR + "driver139//oxser.inf";  
  192. if CheckIIS()   then       
  193. goto SetDotNet;  
  194. else      
  195.     SprintfBox(MB_OK,"IIS安装","您还未安装IIS,请安装!");      
  196. if(LaunchAppAndWait("rundll32.exe""shell32.dll,Control_RunDLL appwiz.cpl,2", WAIT)<0)then  
  197.         SprintfBox(MB_OK,"IIS安装时发生意外,请重新安装!");    
  198. goto SetIIS;  
  199. endif;  
  200.  SetDotNet:  
  201. //判断是否安装了.netframework  
  202. RegDBSetDefaultRoot ( HKEY_LOCAL_MACHINE );  
  203. if ( RegDBKeyExist ("SOFTWARE//Microsoft//.NETFramework//policy//v2.0" ) < 0) then  
  204. SprintfBox(MB_OK,".NET安装","尚未安装.net framework 2.0 !/n请点击“确定”以继续安装!");          
  205. if( LaunchAppAndWait( SUPPORTDIR ^ "dotnetfx.exe" , "/q:a/l" ,WAIT) < 0) then   
  206.           SprintfBox(MB_OK,"安装.net框架时发生意外,请重新安装!");  
  207. 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已安装!");  
  208. endif;              
  209. //----------------------------------------------------------------------   
  210. SetsqlServer:  
  211. //判断是否安装了sql Server        
  212. if ( RegDBSetkeyvalueEx ("SOFTWARE//Microsoft//Microsoft sql Server//80//MSsqlLicenseInfo//MSsql8.00//displayName","displayName",REGDB_STRING,"sql Server 2000",-1 ) < 0) then  
  213. 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请点击“确定”以继续安装!");          
  214. if( LaunchAppAndWait( SUPPORTDIR ^ "sql 2000 Enterprise//AUTORUN.EXE.exe" ,"安装sql Server 2000 时发生意外,248); line-height:24px">      SprintfBox(MB_OK,"sql Server 2000 已安装!");  
  215.      endif;  
  216. endif;     
  217.   //------------------------------------------------------------------       
  218. Dlg_SdWelcome:    //欢迎 对话框      
  219.     szTitle = "欢迎使用YHK_GF安装软件";  
  220.     szMsg = "YHK_GF安装软件将在您的计算机中安装/b/n/b/n“网上阅卷系统”,/b/n/b/n若要继续,请单击“下一步”。";   
  221.     nResult = SdWelcome(szTitle, szMsg);  
  222. if (nResult = BACK) goto Dlg_SdWelcome;  
  223. Dlg_SdLicense2: //软件许可协议  
  224.     szTitle ="欢迎您/b/n请仔细阅读用户协议,本协议具有法律效力!!";  
  225.     szOpt1 = "同意(&A)";  
  226.     szOpt2 = "不同意(&D)";  
  227. //{{IS_SCRIPT_TAG(License_File_Path)  
  228.     szLicenseFile = SUPPORTDIR ^ "用户使用协议.rtf";  
  229. //}}IS_SCRIPT_TAG(License_File_Path)  
  230. //{{IS_SCRIPT_TAG(Dlg_SdLicense2)  
  231.     nResult = SdLicense2Rtf( szTitle, szOpt1, szOpt2, szLicenseFile, bLicenseAccepted );  
  232. //}}IS_SCRIPT_TAG(Dlg_SdLicense2)  
  233. if (nResult = BACK) then  
  234. goto Dlg_SdWelcome;  
  235.         bLicenseAccepted = TRUE;  
  236. Dlg_SdCustomer@R_686_4045@ion:  
  237. //用户信息对话框  
  238.     szMsg = "请您填写用户信息卡";  
  239.     szTitle = "欢迎您/b/n使用YHK安装系统";      
  240.     svName    = "";  
  241.     svCompany = "";  
  242.     nResult = SdCustomer@R_686_4045@ion(szTitle, nUser);  
  243.    
  244.    
  245. Dlg_SetupType: //安装类型对话框  
  246.     szTitle = "安装类型/b/n请选择安装类型";  
  247.     szMsg = "请选择安装";  
  248.     nResult = SetupType(szTitle, "", 0);  
  249. if (nResult = BACK) then  
  250. goto Dlg_SdCustomer@R_686_4045@ion;  
  251.         nSetupType = nResult;  
  252. if (nSetupType != CUSTOM) then  
  253.             nvSize = 0;  
  254.             FeatureCompareSizerequired(MEDIA, INSTALLDIR, nvSize);  
  255.             if (nvSize != 0) then        
  256.                 MessageBox(szSdStr_NotEnoughSpace, WARNING);  
  257. goto Dlg_SetupType;  
  258.             endif;  
  259.             bCustom = FALSE;  
  260. goto Dlg_sql;  
  261.             bCustom = TRUE;  
  262.     endif;      
  263. Dlg_SdaskDestPath:     
  264.     szTitle="";  
  265.     szMsg="";     
  266.     nResult = SdaskDestPath(szTitle, 0);  
  267. goto Dlg_SetupType;  
  268. Dlg_SdFeatureTree:   
  269.     szTitle    = "";  
  270.     szMsg      = "";  
  271. if (nSetupType = CUSTOM) then  
  272.         nResult = SdFeatureTree(szTitle, 2);  
  273. goto Dlg_SdaskDestPath;    
  274.     endif;  
  275. Dlg_sql:  
  276.     nResult = OnsqlLogin( nResult );  
  277. if( nResult = BACK ) then  
  278. if (!bCustom) then  
  279. goto Dlg_SetupType;      
  280. goto Dlg_SdFeatureTree;  
  281. Dlg_SdStartcopy:   //准备就绪对话框    
  282.     szTitle = "可以安装“网上阅卷系统”了/b/n安装准备工作已就绪,可以开始安装了。";  
  283.     szMsg ="";// "单击“安装”以开始安装。/b/n如果要检查或更改任何安装设置,请单击“上一步”。单击“取消”退出安装向导。";  
  284.     listStartcopy = ListCreate( STRINGLIST );  
  285. //The following is an example of how to add a string(svName) to a list(listStartcopy).  
  286. //eg. ListAddString(listStartcopy,svName,AFTER);    
  287.     ListAddString(listStartcopy,"你的选择如下:",AFTER);  
  288.     ListAddString(listStartcopy,"",AFTER);   
  289. 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  
  290. 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  
  291. 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 );           
  292.     ListDestroy(listStartcopy);  
  293. goto Dlg_sql;  
  294. //---------------------------------------------------------------------------------  
  295.      // 在桌面上添加快捷方式   
  296.     AddFolderIcon(FOLDER_DESKTOP,"网上阅卷系统首页","/"http://"+szIp+":8080/Default.aspx/"",TARGETDIR,TARGETDIR+"//TempIco//021.ico","",REPLACE);     
  297. //添加程序快捷方式  
  298.     AddFolderIcon(FOLDER_PROGRAMS^"网上阅卷系统GF安装","网上阅卷系统首页",0); background-color:inherit">//添加卸载快捷方式  
  299. 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     
  300. // 其中     
  301. // {611b4a59-fae0-443b-acbb-8cb1ce57fada}     
  302. // 这个值是这样取得的     
  303. // Project-》Setting-》General-》Project对应的那项     
  304. //---------------------------------------------------------------------------------------------------------------       
  305. // setup default status  
  306.     Enable(STATUSEX);  
  307. return 0;  
  308. end;  
  309. // OnMaintUIAfter  
  310. //  
  311. // The OnMaintUIAfter event called by the framework after the file transfer  
  312. // of the setup when the setup is running in maintenance mode. By default  
  313. // this event displays UI that informs the end user that the maintenance setup  
  314. // has been completed successfully.  
  315. //事件的OnMaintUIAfter所呼吁的框架后,文件传输在安装时,安装程序在维护模式下运行。  
  316. //认情况下 这一事件显示界面,通知最终用户,维修安装 已成功完成。...  
  317. function OnMaintUIAfter()  
  318. 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;  
  319.     NUMBER bOpt1, bOpt2;  
  320.     disable(STATUSEX);  
  321.     bOpt1   = FALSE;  
  322.     bOpt2   = FALSE;  
  323. // Added - Version 9.5 - Use appropriate strings for complete  
  324. // uninstall.  
  325. if( REMOVEALLMODE ) then  
  326.         szTitle = SdLoadString(IFX_SDFINISH_REMOVE_TITLE);  
  327.         szMsg1 = SdLoadString(IFX_SDFINISH_REMOVE_MSG1);   
  328. //卸载完成  
  329.         szTitle="卸载完毕";  
  330.         szMsg1="已完全卸载“网上阅卷系统”";   
  331.         szTitle = SdLoadString(IFX_SDFINISH_MAINT_TITLE);      
  332.         szMsg1  = SdLoadString(IFX_SDFINISH_MAINT_MSG1);  
  333.          szMsg2 ="谢谢您使用保定银河卡电子公司的产品。";  
  334.     SdFinishEx(szTitle, szOption2, bOpt1, bOpt2);  
  335. end;  
  336. // OnFirstUIAfter  
  337. // The OnFirstUIAfter event called by the framework after the file transfer  
  338. // of the setup when the setup is running in first install mode. By default  
  339. // this event displays UI that informs the end user that the setup has been  
  340. // completed successfully.  
  341. //事件的OnFirstUIAfter后调用文件transferof安装时,安装程序在第一次安装模式下运行的框架。  
  342. //认情况下此事件显示界面,通知最终用户,安装程序已成功完成。  
  343. function OnFirstUIAfter()  
  344.     STRING szTitle, szOption2;  
  345.     NUMBER bOpt1, bOpt2;    
  346. string szBmpPath;//自定义  
  347. begin        
  348.         szBmpPath=SUPPORTDIR+"//left.bmp;1;0,0";     
  349.         DialogSetInfo (DLG_INFO_ALtimage,0); background-color:inherit">// 设置左边的图片   
  350.         disable(STATUSEX);  
  351.            //---------------------------------------  
  352. //安装完成之时  
  353.     szTitle = "阅卷系统安装完毕";  
  354.     szMsg1 = "谢谢您使用YHK_GF安装程序!!";   
  355.     szMsg2 = "已成功安装网“网上阅卷系统”,请单击“完成”以退出安装向导。";  
  356.     bOpt1  = FALSE;  
  357.     bOpt2  = FALSE;  
  358.     szMsg1 = SdLoadString(IFX_SDFINISH_MSG1);  
  359.     SdFinishEx(szTitle, bOpt2);  
  360. // OnsqlLogin  
  361. function number OnsqlLogin( nBtn )  
  362. string sMessage;  
  363. string szConnection,szDB, stemp[MAX_PATH];  // szServer, szPassword,   
  364. number nResult, nSize, nCount;  
  365. BOOL   bNext;  //bWinLogin,108); color:inherit; line-height:24px"> LIST   listConnections;      
  366. STRING svResult,svLine;//自定义       
  367. number nvFileHandle;      
  368. //First initialize sql Server runtime  
  369. //第一初始化的sql Server运行  
  370.     sqlRtinitialize2();  
  371.    // Suppress ISsqlSRV.DLL to show a connection error message.  
  372. //禁止ISsqlSRV.DLL显示连接错误信息  
  373.     MsiSetProperty( ISMSI_HANDLE, "IS_sqlSERVER_CA_SILENT""1" );  
  374. //Get the names of all the necessary connections  
  375.     listConnections = sqlRTGetConnections();  
  376.     ListGetFirstString (listConnections, szConnection);  
  377.     nCount = 0;  
  378. //determine if NEXT or BACK will be returned   
  379. //if there are no connections to make  
  380. //确定下一个或返回将被退回  
  381.      //如果没有连接  
  382. if( nBtn != BACK ) then  
  383.         bNext = TRUE;  
  384.         bNext = FALSE;  
  385. //start at end if going BACK  
  386.                 //退回  
  387. while (ISERR_SUCCESS = ListGetNextString( listConnections, szConnection ) );  
  388.             nCount++;  
  389.         endwhile;  
  390. // Login for each connection  
  391. //登录每个连接  
  392. while (nResult = ISERR_SUCCESS)  
  393. //Get Default values for connection  
  394.         //获得连接字符串  
  395.         sqlRTGetConnectionInfo( szConnection, szServer, szDB, szPassword );  
  396.         bWinLogin = sqlRTGetConnectionAuthentication( szConnection );  
  397. // display login dialog (without connection name)  
  398. //显示登录对话框没有连接名称  
  399. // COMMENT OUT TO SWAP DIALOGS  
  400. //注释外部全系统计划的对话  
  401.             nResult = sqlServerSelectLogin2( szConnection, bWinLogin, FALSE, TRUE );  
  402.               //下面的是只显示 登录用户密码不显示数据库和windows登录选择  
  403.              //nResult = sqlServerLogin( "", szPassword );  
  404. // display login dialog (with connection name)  
  405. //显示登录对话框没有连接名称  
  406. // UNCOMMENT TO SWAP DIALOGS  
  407. //注释外部全系统计划的对话  
  408. // nResult = sqlServerSelectLogin2( szConnection, TRUE, TRUE );  
  409. if( nResult = NEXT ) then  
  410.             //store data in case we need it again  
  411.             //保存数据库配置信息,以备下次需要  
  412.             sqlRTPutConnectionInfo2( szConnection, szPassword );  
  413.             sqlRTPutConnectionAuthentication( szConnection, bWinLogin );  
  414. //test connection      
  415. //测试连接  
  416.             nResult = sqlRTTestConnection2( szConnection,108); color:inherit; line-height:24px">             nSize = MAX_PATH;  
  417.             MsiGetProperty( ISMSI_HANDLE, "IS_sqlSERVER_STATUS"stemp, nSize );  
  418.            ifstemp != "0" ) then  
  419.                 nSize = _MAX_PATH;  
  420.                 MsiGetProperty( ISMSI_HANDLE, "IS_sqlSERVER_STATUS_ERROR", sMessage, nSize );  
  421.                       
  422. if( nSize = 0 ) then  
  423.                     Sprintf(sMessage, SdLoadString( IDS_IFX_sql_ERROR_LOGIN_Failed ), szConnection, SdLoadString( ISCRIPT_E_UNKNowN_ERROR_DESC ));  
  424.                 endif;  
  425.                   
  426.                 MessageBox( sMessage, MB_OK );  
  427. //Show same login dialog again  
  428. //显示相同的数据库登录对话框  
  429.                 nResult = ListCurrentString(listConnections, szConnection);  
  430. else //SUCCESS  
  431.                  //成功  
  432. //继续下一个连接  
  433. //Move on to next connection  
  434.                 nCount++;  
  435.                 bNext = TRUE;  
  436.                 nResult = ListGetNextString(listConnections,248); line-height:24px">               // MsiSetProperty  
  437. //设置Property里的值  
  438. (ISMSI_HANDLE,"Connection_Property","server="+szServer+";database=wxd;uid="+szUser+";pwd="+szPassword);  
  439. //BACK  
  440. //回退  
  441.             nCount--;  
  442.             bNext = FALSE;  
  443.             nResult = ListSetIndex( listConnections, nCount );  
  444.             ListCurrentString( listConnections, szConnection );  
  445.     endwhile;  
  446. if( bNext ) then  
  447. return NEXT;  
  448. return BACK;  
  449. end;        
  450. // OnMaintUIBefore  
  451. // The OnMaintUIBefore event is called by the framework when the setup is  
  452. // running in maintenance mode. By default this event displays UI that  
  453. // allows the end user to add or remove features, repair currently  
  454. // installed features or uninstall the application.  
  455. //该事件被称为OnMaintUIBefore由框架时,安装程序 在维护模式下运行。  
  456. //认情况下此事件显示界面, 允许最终用户添加删除功能,目前维修 安装的功能或卸载应用程序。  
  457. function OnMaintUIBefore()  
  458. 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;  
  459. 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;    
  460. //自定义   
  461.     STRING  szBmpPath;     
  462.  SetTitle("欢迎您使用银河卡电子公司的软件", BACKGROUNDCAPTION );//设置标题  
  463. 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     
  464. //如果你要启用的背景,窗口标题标题标题栏                               
  465. 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 );                      
  466. 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 );               
  467. 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));                    
  468. // Enable( FULLWINDOWMODE );                          
  469. // Enable( BACKGROUND );                              
  470. Dlg_Start:  
  471.           
  472.           
  473. //----------------------------------------------------------------      
  474. //此处为第二次是卸载  
  475.     svResult   =  SdLoadString(IFX_MAINTUI_MSG);     
  476.     szCaption   = SdLoadString(IFX_ONMAINTUI_CAPTION);   
  477.     svResult="是否要完全卸载“网上阅卷系统”?";   
  478.     szCaption="确认卸载";   
  479.     nResult   =   SprintfBox(MB_OKCANCEL,szCaption,"%s",svResult);     
  480. if   (nResult   =   IDCANCEL)   then     
  481.         exit;     
  482.     elseif(nResult   =   IDOK)   then      
  483. //   setup   default   status     
  484.         SetStatusWindow(0,   "");     
  485.         Enable(STATUSEX);     
  486.         StatusUpdate(ON,   100);      
  487. //-->Remove   all   components    
  488.         ComponentRemoveAll();      
  489. //-------------------------------------------------------------------------------------------  
  490. //分离数据库EXEC sp_detach_db @dbname = '数据库名称  
  491. //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;   
  492. //DetachDB();  
  493. //-----------------------------------------------------------------------------------------------------       
  494. //----------------------------------------------------------------------------  
  495.     DeleteDir(TARGETDIR,ALLCONTENTS);     
  496.     DeleteDir(TARGETDIR,ONLYDIR);    
  497. //---------------------------------------------------------------------  
  498.     endif;     
  499. return   0;     
  500. //------------------------------------------------------------  
  501. // Added in Version 9.5 - Support for REMOVEONLY option.  
  502. //新增的版本9.5 - 为REMOVEONLY选择支持  
  503. if( !REMOVEONLY ) then  
  504. // In standard mode show maintenance dialog  
  505. //在标准模式对话框显示维修  
  506.         disable(BACKBUTTON);  
  507.         nType = SdWelcomeMaint(szTitle, MODIFY);  
  508.         Enable(BACKBUTTON);  
  509. // Hide the initial progress dialog as otherwise the user can  
  510. // click on it, and hide the MessageBox.  
  511. //隐藏,否则用户的对话,可以初步进展点击它,并隐藏在MessageBox  
  512.         disable( DIALOGCACHE );  
  513. // In RemoveOnly mode, set to remove.  
  514. //在RemoveOnly模式,设置删除  
  515.         nType = REMOVEALL;  
  516. // Show Uninstall Confirmation Dialog  
  517. //显示卸载确认对话框  
  518. if ( nType = REMOVEALL ) then  
  519.         nResult = MessageBox( SdLoadString( IFX_MAINTUI_MSG ), MB_YESNO );  
  520. if (nResult != IDYES ) then  
  521.               
  522. if( REMOVEONLY ) then  
  523. // In REMOVEONLY mode, abort the setup.  
  524. //显示卸载确认对话框  
  525.                 abort;  
  526. // In non-REMOVEONLY mode, redisplay the prevIoUs dialog.  
  527. //在非REMOVEONLY模式,重新显示以前的对话。  
  528. goto Dlg_Start;  
  529.     nResult = NEXT;  
  530. Dlg_SdFeatureTree:  
  531. if (nType = MODIFY) then  
  532.         szTitle = "";  
  533.         szMsg = "";  
  534.         nResult = SdFeatureTree(szTitle, 2);  
  535. goto Dlg_Start;  
  536.     endif;  

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐