inno setup检查是否已经安装

[Registry]
Root: HKLM; Subkey: "Software\MCS"; ValueType: string; ValueName: "MCSVersion"; ValueData: "1.0.6"; Flags: uninsdeletevalue

[Code]
function GetMCSVersion(): String;
var MCSVersion: String;
begin
MCSVersion :='';
RegQueryStringValue(HKLM, 'Software\MCS', 'MCSVersion', MCSVersion);
Result := MCSVersion;
end;

function InitializeSetup(): Boolean;
var MCSVersion: String;
begin
MCSVersion := GetMCSVersion();
result := true;
if length(MCSVersion) > 0 then begin
//如果发现程序已经安装过了
MsgBox ('本程序已经安装,请卸载后再安装本程序. 安装程序将关闭.', mbError, MB_OK);
result := false;
end;
end;

 

posted @ 2015-12-15 16:04  明明是悟空  阅读(1707)  评论(0编辑  收藏  举报