Installshield安装软件

Installshield安装软件,第1张

概述1.新建InstallScript Project 2.在Project Assistant 视图中填写Project的基本信息和文件及文件夹 3.InstallScript介绍()语法类似C; //以下的那些d出窗口都可以在user interface -->dialog中找到.可以修改. //user interface 下skin可改安装程序皮肤 #include "ifx.h" funct

1.新建InstallScript Project

2.在Project Assistant 视图中填写Project的基本信息和文件及文件夹

3.InstallScript介绍()语法类似C;

//以下的那些d出窗口都可以在user interface -->dialog中找到.可以修改.
//user interface 下skin可改安装程序皮肤

#include "ifx.h"
function OnFirstUIBefore()//执行安装程序的第一个窗口时执行
    number  nResult,nLevel,nSize,nSetupType;
    string  szTitle,szMsg,szOpt1,szOpt2,szlicensefile;
    string  szname,szCompany,szTargetPath,szDir,szFeatures;
    BOol    blicenseAccepted;     
begin     
    nSetupType = COMPLETE;   
    szDir = TARGETDIR;
    szname = "";
    szCompany = "";
    blicenseAccepted = FALSE;
  
// Beginning of UI Sequence
Dlg_Start:
    nResult = 0;

Dlg_SDWelcome:
    szTitle = "";
    szMsg = "";
    //{{IS_SCRIPT_TAG(Dlg_SDWelcome)
    nResult = SDWelcome( szTitle,szMsg );//d出欢迎窗口
    //}}IS_SCRIPT_TAG(Dlg_SDWelcome)
    if (nResult = BACK) goto Dlg_Start;

Dlg_Sdlicense2:
    szTitle = "";
    szOpt1 = "";
    szOpt2 = "";
    //{{IS_SCRIPT_TAG(license_file_Path)
    szlicensefile = SUPPORTDIR ^ "license.rtf";//找一个名为license.rtf的文件(协议风容放在Support files/Billboards  language independent下面)
    //}}IS_SCRIPT_TAG(license_file_Path)
    //{{IS_SCRIPT_TAG(Dlg_Sdlicense2)
    nResult = Sdlicense2Rtf( szTitle,szlicensefile,blicenseAccepted );//d出协议窗口
    //}}IS_SCRIPT_TAG(Dlg_Sdlicense2)
    if (nResult = BACK) then
        goto Dlg_SDWelcome;
    else
        blicenseAccepted = TRUE;
    endif;

Dlg_SdRegisterUser:
    szMsg = "";
    szTitle = "";
    //{{IS_SCRIPT_TAG(Dlg_SdRegisterUser)   
    //nResult = SdRegisterUser( szTitle,szname,szCompany );
    //}}IS_SCRIPT_TAG(Dlg_SdRegisterUser)
    if (nResult = BACK) goto Dlg_Sdlicense2;

Dlg_SetupType2:  
    szTitle = "";
    szMsg = "";
    nResult = CUSTOM;
    //{{IS_SCRIPT_TAG(Dlg_SetupType2)   
    //nResult = SetupType2( szTitle,"",nSetupType,0 );
    //SdShowDlgEdit1 (szTitle,szTargetPath);
    //}}IS_SCRIPT_TAG(Dlg_SetupType2)
    if (nResult = BACK) then
        goto Dlg_Sdlicense2;
    else
        nSetupType = nResult;
        if (nSetupType != CUSTOM) then
            szTargetPath = TARGETDIR;
            nSize = 0;
            FeatureCompareSizerequired( MEDIA,nSize );
            if (nSize != 0) then     
                MessageBox( szSdStr_NotEnoughSpace,WARNING );
                goto Dlg_SetupType2;
            endif;
        endif;  
    endif;

Dlg_SdaskDestPath2:
    if ((nResult = BACK) && (nSetupType != CUSTOM)) goto Dlg_SetupType2;
    szTitle = "";
    szMsg = "";
    if (nSetupType = CUSTOM) then
                //{{IS_SCRIPT_TAG(Dlg_SdaskDestPath2)   
        nResult = SdaskDestPath2( szTitle,szDir );
                //}}IS_SCRIPT_TAG(Dlg_SdaskDestPath2)
        TARGETDIR = szDir;
    endif;
    if (nResult = BACK) goto Dlg_Sdlicense2;

Dlg_SdFeatureTree:
    if ((nResult = BACK) && (nSetupType != CUSTOM)) goto Dlg_SdaskDestPath2;
    szTitle = "";
    szMsg = "";
    szFeatures = "";
    nLevel = 2;
    if (nSetupType = CUSTOM) then
        //{{IS_SCRIPT_TAG(Dlg_SdFeatureTree)   
        //nResult = SdFeatureTree( szTitle,TARGETDIR,szFeatures,nLevel );
        //}}IS_SCRIPT_TAG(Dlg_SdFeatureTree)
        if (nResult = BACK) goto Dlg_SdaskDestPath2; 
    endif;

Dlg_sqlServer:
    nResult = OnsqlServerInitialize( nResult );
    if( nResult = BACK ) goto Dlg_SdFeatureTree;

Dlg_Objdialogs:
    nResult = ShowObjWizardPages( nResult );
    if (nResult = BACK) goto Dlg_sqlServer;
   
Dlg_SdStartcopy2:
    szTitle = "";
    szMsg = "";
    //{{IS_SCRIPT_TAG(Dlg_SdStartcopy2)   
    nResult = SdStartcopy2( szTitle,szMsg );   
    //}}IS_SCRIPT_TAG(Dlg_SdStartcopy2)
    if (nResult = BACK) goto Dlg_Objdialogs;

    // Added in 11.0 - Set appropriate StatusEx static text.
    SetStatusExStaticText( SdLoadString( IDS_IFX_STATUSEX_STATICTEXT_FirsTUI ) );
 
    return 0;
end;
//---------------------------------------------------------------------------
// OnBegin
//
// The OnBegin event is called directly by the framework after the setup
// initializes. Note that this event will be called AFTER "Initialization"
// events (i.e.) OnSetTARGETDIR,OnCheckMediaPassword.
//
// Note: This event will not be called automatically in a
// program...endprogram style setup.
//---------------------------------------------------------------------------
function OnBegin()  //程序开始时执行
string     szInfoString;
begin
     //增加背景图片
    szInfoString = SUPPORTDIR ^ "bbrd8.bmp" ;
    DialogSetInfo ( DLG_INFO_ALtimage,szInfoString,TRUE);
   
    //设置安装程序时的桌面背景
    Enable( BACKGROUND );
    Enable(FulLWINDOWMODE); 
    PlaceBitmap(SUPPORTDIR ^ "bbrd7.bmp",13,FulLSCREENSIZE);  
    //SetdisplayEffect(EFF_FADE)
    //PlaceBitmap(szInfoString,12,10,UPPER_left);
end;
//---------------------------------------------------------------------------
// OnEnd
//
// The OnEnd event is called at the end of the setup. This event is not
// called if the setup is aborted.
//---------------------------------------------------------------------------


下面是执行系统批处理(注册MysqL,tomcat服务)如何注册tomcat,MysqL服务上一篇中已讲到

export prototype DefaultFeature_Installed();
function DefaultFeature_Installed()    
STRING myInifile,baseDir,dataDir; 
STRING tomcatStart,MysqLStart;    
STRING  BASEPATH,TEMP;    
NUMBER  nSize,i;
begin  
//设置MysqL的my.ini配置文件的要根目录
 
//替换//成/
BASEPATH = TARGETDIR;
StrRemoveLastSlash(BASEPATH);
nSize = StrLength(BASEPATH);
i=0;
while (i < nSize)
if (BASEPATH[i] = "//") then
BASEPATH[i] = "/";
endif;
    i = i + 1;
enDWhile;
//处理完//成/
myInifile=BASEPATH+"/MysqL5/my.ini";
baseDir= "basedir=/""+BASEPATH+"/MysqL5//"";
dataDir="datadir=/""+BASEPATH+"/MysqL5/data//"";
fileInsertline (myInifile,dataDir,80,BEFORE);
fileInsertline (myInifile,BEFORE);    

//注册MysqL成系统服务
//ServiceAddService("OupuMysqL222","OupuMysqLServer222","MysqL5021",TARGETDIR+"//mysql5//bin//mysqld-nt.exe",TRUE,""); 
//启动MysqL服务
//ServiceStartService("OupuMysqL222","");   
       
//调用 启动MysqL.bat
MysqLStart = TARGETDIR+"//mysql5//bin//启动MysqL.bat";
LaunchAppAnDWait (MysqLStart,WAIT);
//调用 启动tomcat.bat  
tomcatStart = TARGETDIR+"//tomcat-5.5.20//bin//启动tomcat.bat";
LaunchAppAnDWait (tomcatStart,WAIT); 

 


end;
//---------------------------------------------------------------------------
// The UnInstalling event is sent just before the feature
// DefaultFeature is uninstalled.
//---------------------------------------------------------------------------
 
export prototype DefaultFeature_UnInstalling();
function DefaultFeature_UnInstalling()    
STRING tomcatStop,MysqLStop;
begin 
//取消服务注册   
//调用 启动MysqL.bat
MysqLStop = TARGETDIR+"//mysql5//bin//停止MysqL.bat";
LaunchAppAnDWait (MysqLStop,WAIT);
//ServiceRemoveService("OupuMysqL222");  
//调用 启动tomcat.bat  
tomcatStop = TARGETDIR+"//tomcat-5.5.20//bin//停止tomcat.bat";
LaunchAppAnDWait (tomcatStop,WAIT); 

end;

4.添加uninstall快捷方式郁闷了N久.
  其实installshIEld本身已经自带uninstall程序.在你安装自己打包的程序时installshIEld会在C:/Program files/下创建一个InstallShIEld Installation information文件夹,下面再有一个{DE407BEB-F8AD-475F-AB69-73590C37D34F}的文件夹.DE407BEB-F8AD-475F-AB69-73590C37D34F是你程序的GUID 在General information-->product property-->product GUID可以看到..此文件夹下面有反安装程序.只要在setup动行的时候加一个 -uninst的参数就变成了卸载程序


 知道这个就好办了.添加一个快捷方式.把路径指(target)定为<PROGRAMfileS>/InstallShIEld Installation information/{DE407BEB-F8AD-475F-AB69-73590C37D34F}/Setup.exe,DE407BEB-F8AD-475F-AB69-73590C37D34F是你的GUID 自己手动替换一下.改一下Arguments参数为:/uninst


本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/deeplyloving/archive/2008/07/18/2673143.aspx

总结

以上是内存溢出为你收集整理的Installshield安装软件全部内容,希望文章能够帮你解决Installshield安装软件所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/sjk/1181920.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-02
下一篇 2022-06-02

发表评论

登录后才能评论

评论列表(0条)

保存