Inno Setup 打包安裝判斷是否安裝.net freamework 3.5 和 access2007的數據連接

[code]
//安裝前方法
function InitializeSetup: Boolean;

var Path:string ;

    ResultCode: Integer;

begin

  if RegKeyExists(HKLM, 'SOFTWARE\Microsoft\.NETFramework\v3.0 SP1')=false then

  begin
    Path := ExpandConstant('Setup\DotNetFX35\dotNetFx35setup.exe');

    Exec(Path, '', '', SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode);

  end
  if RegKeyExists(HKLM, 'SOFTWARE\Microsoft\office\12.0')=false then

  begin
    Path := ExpandConstant('Setup\AccessDatabaseEngineForEnglish.exe');

    Exec(Path, '', '', SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode);

  end
  
  if RegKeyExists(HKLM, 'SOFTWARE\Microsoft\.NETFramework\v3.0 SP1') and RegKeyExists(HKLM, 'SOFTWARE\Microsoft\office\12.0') then
  begin
  Result := true;
  end
  else
  begin
  MsgBox('請不要跳過所需運行庫安裝向導,否則無法繼續安裝!',mbInformation,MB_OK);
  Result := false;
  end

end;
//卸載前方法
function InitializeUninstall(): Boolean;
begin
  Result := MsgBox('InitializeUninstall:' #13#13 'Uninstall is initializing. Do you really want to start Uninstall?', mbConfirmation, MB_YESNO) = idYes;
  if Result = False then
    MsgBox('InitializeUninstall:' #13#13 'Ok, bye bye.', mbInformation, MB_OK);
end;
//程序卸載中
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
    if CurUninstallStep = usUninstall then
      MsgBox('哇哈哈',mbInformation,MB_OK);
end;

//操作註冊表 卸載事件
[Registry]
Root: HKCR; Subkey: "*\shell\Lock 文件加密"; ValueType: string; ValueName: "Lock 文件加密"; ValueData: "{app}"; Flags: uninsdeletekey

 詢問語句
 if MsgBox('系统检测到您没有安装.Net Framework2.0,是否立刻下载并安装?', mbConfirmation, MB_YESNO) = idYes then   
posted @ 2010-04-14 14:10  cxc414  阅读(2305)  评论(0编辑  收藏  举报