installshield修改注册表

时间:2022-12-31 15:34:48

 1.修改注册表

prototype int changreg();

function int changreg() 
    number nRootKey,nType,nSize;
    string szKey,szNumName;
    STRING szNumValue;
    int res;
begin   
    //启用IE的对未可信的ActiveX初始化...选项
    nRootKey = HKEY_CURRENT_USER;
    RegDBSetDefaultRoot (nRootKey);//置根为nRootKey
    //注册子项
    szKey="Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\Zones\\2";
    nType=REGDB_NUMBER;
    nSize=4;
    //注册安装路径
    szNumName="1201";
    szNumValue="0";
    res = RegDBSetKeyValueEx(szKey,szNumName,nType,szNumValue,nSize);
    if(res < 0) then
        MessageBox("允许初始化未授信ActiveX出错!", WARNING);
    endif;
   
    szNumName="1209";   //允许Scriptlet
    res = RegDBSetKeyValueEx(szKey,szNumName,nType,szNumValue,nSize);
    if(res < 0) then
        MessageBox("修改IE注册表出错!", WARNING);
    endif; 
    /*************************************************************************/
     szNumName="1201";
     szKey="Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\Zones\\3";
      res = RegDBSetKeyValueEx(szKey,szNumName,nType,szNumValue,nSize);
    if(res < 0) then
        MessageBox("允许初始化未授信ActiveX出错!!", WARNING);
    endif;
   
    szNumName="1209";   //允许Scriptlet
    res = RegDBSetKeyValueEx(szKey,szNumName,nType,szNumValue,nSize);
    if(res < 0) then
        MessageBox("修改IE注册表出错!", WARNING);
    endif; 
 
    return 0;
end;

 

2. 自定义带参函数

 

prototype int RunExe(STRING); //定义参数的时候不能有变量名,只要变量类型

//fileName是最终的绝对路径
function int RunExe(fileName)   //直接写参数名,很变态的语法
begin    
 
    if (LaunchAppAndWait(fileName, "", WAIT) < 0) then    //指定可执行文件,第二个参数是exe的输入参数,一般为""
      MessageBox("视屏解码库安装出错!",WARNING);     
    endif;
   
end;

 

3.判断是不是第一次安装,第一次安装 MAINTENANCE为false,如果是维护的话MAINTENANCE为true

  if ( !MAINTENANCE ) then
      MessageBox("安装", WARNING);
   endif;