IS---InstallShield第二天

在Setup.rul中,新增OnBegin函数


STRING str1,spath,szApplicationPath,szApplicationCmdLine,szCmdLine;
function OnBegin()    
begin
    // TO DO: you may change default non-UI setting, for example
    //
    // You may also perform your custom initialization steps, check requirements, etc.  
    Disable(BACKBUTTON);
    if(!MAINTENANCE)then
    SdLicense2("License","","",SUPPORTDIR^"协议.txt",FALSE);
    endif;         

    //------------------------------------------------------------------------------------
    szApplicationPath = WINSYSDIR ^ "msiexec.exe";
    szApplicationCmdLine = "/i c:\\mysql.msi";
    LongPathToQuote( szApplicationPath, TRUE );
    szCmdLine = szApplicationPath + " " + szApplicationCmdLine;

    RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
    MessageBox ("You are here", INFORMATION);
if(RegDBKeyExist("SOFTWARE\\MySQL AB\\MySQL Connector/ODBC 5.2 64bit(community edition)")<0)then    
    MessageBox ("You are here1", INFORMATION);
    MessageBox(PROGRAM,INFORMATION);  
    MessageBox(SRCDIR,INFORMATION);  
    MessageBox(szCmdLine,INFORMATION);
    LaunchAppAndWait("",szCmdLine, LAAW_OPTION_WAIT);
endif;


end;功能:在安装时,出现许可证后检测是否系统中安装必要的组件,如果没有安装就提示安装。有,则跳过。当必要组件是.exe的文件。直接加载到support中即可。如果是.msi后缀的文件需要调用window installer来安装。用到的函数是LaunchAppAndWait(szProgram, szCmdLine, nOptions )


szProgram:Specifies the complete path and file name of the application to be launched.

szCmdLine:Specifies the command-line parameters to pass to the launched application.

nOptions:LAAW_OPTION_WAIT----Passed through the function to WaitForApplication.

 

 

你可能感兴趣的:(Install)