InstallShield 之String Table /property /path变量

仔细了解了下,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:

prototype STRING GetValue(STRING);
prototype VOID SetValue(
STRINGSTRING);

function STRING 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 used to represent source paths are not available at run time, only at build time.

 

posted on 2007-10-11 16:17  Haozes  阅读(2975)  评论(5编辑  收藏  举报