本来想在InstallShield脚本里添加打开IE的函数,但是发现如果在InstallShield自动生成的脚步代码中添加打开IE的函数并不是在安装结束后打开IE。貌似InstallShield自动生成的脚本代码在结束后才进行真正的程序安装(即:源文件装到哪相应的地方),怎么实现程序安装完全,各种文件拷贝结束后打开IE呢?请高手指点!!

解决方案 »

  1.   

    能把你的 打开IE脚本贴出来吗,我也学学个人觉得在OnEnd()里面写
      

  2.   

    OnEnd()在什么地方,我没找到呀。
      

  3.   


    #include "ifx.h"
    function OnFirstUIBefore()
        number  nResult, nLevel, nSize, nSetupType,nvType,nvSize,nError,nvFileHandle,nMark;
        string  szTitle, szMsg, szOpt1, szOpt2, szLicenseFile,szFilePath,szPath;
        string  szName, szCompany, szTargetPath, szDir, szFeatures,szCommandLine;
        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)   
         //找到对应收藏夹路径的注册表项
        RegDBSetDefaultRoot(HKEY_CURRENT_USER);  
        szPath="Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders" ;
        //获得收藏夹路径  
        RegDBGetKeyValueEx(szPath,"Favorites",nvType,szFilePath,nvSize); 
        //在收藏夹里创建文件    
           OpenFileMode (FILE_MODE_APPEND); //定义创建文件类型 
           //进行写操作
           nError=CreateFile (nvFileHandle, szFilePath, "移动式综合检测车电子文档系统.url");  
           nError=WriteLine (nvFileHandle, "[DEFAULT]"); 
           nError=WriteLine (nvFileHandle, "BASEURL=http://localhost/bzc/html/main.asp"); 
           nError=WriteLine (nvFileHandle, "[InternetShortcut]");  
           nError=WriteLine (nvFileHandle, "URL=http://localhost/bzc/html/main.asp");
           nError=WriteLine (nvFileHandle, "IDList=");
           nError=WriteLine (nvFileHandle, "[{000214A0-0000-0000-C000-000000000046}]");
           nError=WriteLine (nvFileHandle, "Prop3=19,2"); 
        //找到对应主页的注册表项
        RegDBSetDefaultRoot(HKEY_CURRENT_USER);
        szPath="Software\\Microsoft\\Internet Explorer\\Main";                           
        //设定主页
        RegDBSetKeyValueEx (szPath, "Start Page", REGDB_STRING, "http://localhost/bzc/html/main.asp", -1);     
        //RegDBSetKeyValueEx (szPath, "Local Page", REGDB_STRING, "http://localhost/bzc/html/main.asp", -1); 
       // RegDBSetKeyValueEx (szPath, "Start Page", REGDB_STRING, "http://www.baidu.com/", -1); 
        
       // RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
        //szPath="SOFTWARE\\Microsoft\\Internet Explorer\\Main"; 
        //设定主页
       // RegDBSetKeyValueEx (szPath, "Start Page", REGDB_STRING, "http://localhost/bzc/html/main.asp",  -1); 
       // RegDBSetKeyValueEx (szPath, "Local Page", REGDB_STRING, "http://localhost/bzc/html/main.asp",  -1); 
       // RegDBSetKeyValueEx (szPath, "Start Page", nvType, "http://www.baidu.com/", nSize); 
       
       
        nResult = SdWelcome( szTitle, szMsg );
        //}}IS_SCRIPT_TAG(Dlg_SdWelcome)
        if (nResult = BACK) goto Dlg_Start;Dlg_SdLicense2:
        szTitle = "";
        szOpt1 = "";
        szOpt2 = "";
        //{{IS_SCRIPT_TAG(License_File_Path)
        szLicenseFile = SUPPORTDIR ^ "移动式综合检测车电子文档系统安装使用协议.txt";
        //}}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;
        else
            bLicenseAccepted = TRUE;
        endif;Dlg_SdRegisterUser:
        szMsg = "";
        szTitle = "";
        //{{IS_SCRIPT_TAG(Dlg_SdRegisterUser)
        nResult = SdRegisterUser( szTitle, szMsg, 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, szMsg, "", nSetupType, 0 );
        //}}IS_SCRIPT_TAG(Dlg_SetupType2)
        if (nResult = BACK) then
            goto Dlg_SdRegisterUser;
        else
            nSetupType = nResult;
            if (nSetupType != CUSTOM) then
                szTargetPath = TARGETDIR;
                nSize = 0;
                FeatureCompareSizeRequired( MEDIA, szTargetPath, 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, szMsg, szDir );
                    //}}IS_SCRIPT_TAG(Dlg_SdAskDestPath2)
            TARGETDIR = szDir;
        endif;
        if (nResult = BACK) goto Dlg_SetupType2;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, szMsg, 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 = ""; 
        //IE的路径
        szCommandLine ="c:\\Program Files\\Internet Explorer\\iexplore.exe";
        //{{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.
        //打开IE
        nMark=LaunchApp(szCommandLine,"");    SetStatusExStaticText( SdLoadString( IDS_IFX_STATUSEX_STATICTEXT_FIRSTUI ) );  
       
        return 0; 
        
    end;
      

  4.   

      上面是我制作打包的脚步代码,通过调试我发现当OnFirstUIBefore()函数结束的时候才进行文件的复制(即return 0后才进行文件复制),无论我把打开网页的代码放在那里都不能实现“文件复制结束后打开网页”,都是在复制前打开的网页。希望高手给个提示!!
      

  5.   

    OnFirstUIBefore 函数就是在第一个界面出现后开始执行的函数,看这个标签:Dlg_SdStartCopy2,在这个之后才开始拷贝的数据。
    你没有添加OnEnd函数,至于如何添加这个函数你可以看看这个老帖子。
    http://topic.csdn.net/u/20080201/18/1c93a532-782a-4c7b-b130-21f70917faf4.html
    不做安装程序好多年,只能帮你这么多。
      

  6.   

    感谢大家帮我解决问题,我仔细看了下找到了OnEnd()函数,InstallShield12的脚本代码的左上的下拉菜单选after Data move选项,然后在右上的下拉菜单选择OnEnd()函数即自动插入,然后就如“inforum"所说的那样在OnEnd()里加入打开网页的程序即可。