无法在“InstallscriptMSI”类型项目中设置/获取INSTALLDIR属性

时间:2012-05-29 04:55:52

标签: windows installshield

尝试使用MsiSetProperty / MsiGetProperty方法设置/获取INSTALLDIR属性。但是在InstallscriptMSI项目的情况下它不起作用。我在这里缺少什么?

在其他论坛中发现,在某些情况下,Installshield属性的访问权限有限。

1 个答案:

答案 0 :(得分:0)

注意:

MsiGetProperty和MsiSetProperty属性不能用于延迟的InstallScript自定义操作,这些操作无权访问活动的.msi数据库,也无法识别任何Windows Installer属性。他们只能访问已写入执行脚本的信息。

示例:

// Include header file for built-in functions 

#include "isrt.h" 

// Include header file for MSI API functions and constants 

#include "iswi.h"
export prototype Func1(HWND);
function Func1(hMSI)
STRING svName;
NUMBER nvSize, nResponse; 

begin 

// Retrieve the user's name from the MSI database 

nvSize = 256; 

MsiGetProperty (hMSI, "USERNAME", svName, nvSize); 



nResponse = AskYesNo ("Your name will be registered as " + 

                     svName + ". Is this correct?", YES); 


if nResponse = NO then 

    AskText ("Enter the name that will be registered for " + 

             "this product.", svName, svName); 

    MsiSetProperty(hMSI, "USERNAME", svName); 

endif; 

end;