Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/string/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
String Installshield中的全局字符串_String_Variables_Installshield - Fatal编程技术网

String Installshield中的全局字符串

String Installshield中的全局字符串,string,variables,installshield,String,Variables,Installshield,我试图在Installshield中有一个全局字符串,以便可以在多个位置访问它。这是我第一次使用它编写脚本。以下是我所拥有的: STRING DIR; .... DIR="c:\\tempdir"; function Completed_Action() begin // Here is where I try to access the DIR string. 但它总是给我错误。有没有办法在任何函数之前拥有一个全局字符串并设置它的值?我还应该补充一点,这是在主Setup.rul

我试图在Installshield中有一个全局字符串,以便可以在多个位置访问它。这是我第一次使用它编写脚本。以下是我所拥有的:

STRING DIR;

....

DIR="c:\\tempdir";

function Completed_Action()
begin
    // Here is where I try to access the DIR string.
但它总是给我错误。有没有办法在任何函数之前拥有一个全局字符串并设置它的值?我还应该补充一点,这是在主Setup.rul之后调用的子rul脚本中


提前感谢。

如果您使用的是InstallShield 11.5及更早版本,您可以在
OnBegin
方法中初始化任何变量


对于InstallShield 12及更高版本,使用
MsiSetProperty
MsiGetProperty(hMSI,“MyVariable”,szSupportDir,nLen)
设置和获取全局变量,因为当基本MSI安装执行InstallScript自定义操作时,在调用该操作之前会加载编译的InstallScript,并且在操作完成后卸载。

如果安装过程中有多个脚本,每个脚本是否都有一个onBegin?我试着把它们放在要启动的初始文件的onBegin中(我在组件一中使用它们),但是,我基本上得到了相同的错误。似乎它们必须在我需要它们的脚本中?实际上它现在在OnBegin中起作用了。我一定是把它放错了。谢谢