代码改变世界

HOWTO:如果检测用户是从系统的“添加/删除”中卸载软件

2010-09-16 15:24  Kevin.Wan  阅读(3303)  评论(2)    收藏  举报

版权声明: 可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息。

在事件响应函数OnMaintUIBefore中添加如下代码:

    if (!ADDREMOVEthen
         
// Setup is not being run from Add/Remove Programs
    
else
         
// Setup is being run from Add/Remove Programs   
         
MessageBox("Setup run from Add/Remove Programs is forbiden",INFORMATION);
         
abort;
    
endif;

注意:上述方法适用于InstallScript和InstallScript MSI工程。