尝试使用MsiSetProperty / MsiGetProperty方法设置/获取INSTALLDIR属性。但是在InstallscriptMSI项目的情况下它不起作用。我在这里缺少什么?
在其他论坛中发现,在某些情况下,Installshield属性的访问权限有限。
答案 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;