InstallShield 之String Table /property /path变量

来源:互联网 发布:java utf 16 编辑:程序博客网 时间:2024/06/05 14:40

 //原文链接:http://www.cnblogs.com/solo/archive/2008/05/09/921202.html

仔细了解了下,InstallShield这几种定义的变量的用法:
1.String Tables里的变量:
Installation Information->General Information->String Tables 在设置的语言中:如Chinese(Simplified) 添加变量TestStr 并设置值。在Script中使用方法:
eg.

STRING tempStr;
BEGIN
     tempStr=@TestStr;
MessageBox(tempStr,INFORMATION);
END;

2.Property:
Behavior and Logic->Property Manager 添加变量如SoloProperty.在Script中使用语法:
eg.

function OnBegin()     
STRING tempStr,tempStr2;  
   
STRING svUsername[256];
     NUMBER nBuffer;
begin
     nBuffer
= 256;
     MsiGetProperty(ISMSI_HANDLE,
"SoloProperty", svUsername, nBuffer);
     MessageBox(
"SoloProperty Value is =" + svUsername, INFORMATION);
    
Exit;
end;

A useful function like this,:-):
Code:

prototypeSTRING GetValue(STRING);
prototype VOID SetValue(
STRING,STRING);

functionSTRING GetValue(szName)
    
STRING szResult;
     NUMBER nLength;
     NUMBER nRetVal;
begin
     nLength
= 1024;
     nRetVal
= MsiGetProperty(ISMSI_HANDLE, szName, szResult, nLength);
    
if(nRetVal != ERROR_SUCCESS)then
         MessageBox(
"Error retrieving value for:" + szName, WARNING);
     endif;
     return szResult;
end;             

function VOID SetValue(szName, szValue)
     NUMBER nRetVal;
begin
     nRetVal
= MsiSetProperty(ISMSI_HANDLE, szName, szValue);
    
if(nRetVal != ERROR_SUCCESS)then
         MessageBox(
"Error setting value for:" + szName, WARNING);
     endif;
end;


useage Code:

svMyValue= GetValue("SOME_PROPERTY");
SetValue(
"SOME_OTHER_PROPERTY", svMyValue);

3. Path variables:
Media->Path Variables
找到这句话:

Path variables usedto represent source paths arenot available at runtime, only at buildtime.
原创粉丝点击