杉宫竹苑工作室

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 1886|回复: 0

.net框架检测,重复安装检测

[复制链接]
发表于 2016-8-28 15:47:35 | 显示全部楼层 |阅读模式

正式会员享受无限制浏览网站功能和高速网盘下载,赶快加入本站吧!

您需要 登录 才可以下载或查看,没有账号?立即注册

x
  1. ; 脚本由 Inno Setup 脚本向导 生成!
  2. ; 有关创建 Inno Setup 脚本文件的详细资料请查阅帮助文档!

  3. #define MyAppName "小小鸟软件"
  4. #define MyAppVersion "2012.2.29"
  5. #define MyAppPublisher "小小鸟科技"
  6. #define MyAppURL "http://www.cnblogs.com/IT-SmallBird/"
  7. #define MyAppExeName "IT.exe"
  8. #define MyWebName "访问小小鸟博客"

  9. [Setup]
  10. ; 注: AppId的值为单独标识该应用程序。
  11. ; 不要为其他安装程序使用相同的AppId值。
  12. ; (生成新的GUID,点击 工具|在IDE中生成GUID。)
  13. AppId={{F5F13326-A1B3-4AB9-9254-325D1B88913E}
  14. AppName={#MyAppName}
  15. AppVersion={#MyAppVersion}
  16. ;AppVerName={#MyAppName} {#MyAppVersion}
  17. AppPublisher={#MyAppPublisher}
  18. AppPublisherURL={#MyAppURL}
  19. AppSupportURL={#MyAppURL}
  20. AppUpdatesURL={#MyAppURL}
  21. DefaultDirName=D:\Program Files\小小鸟软件
  22. DefaultGroupName={#MyAppName}
  23. DisableProgramGroupPage=yes
  24. OutputDir=C:\Documents and Settings\Administrator\桌面
  25. OutputBaseFilename=zlMember
  26. SetupIconFile=F:\IT\logo.ico
  27. Compression=lzma
  28. SolidCompression=yes

  29. [Languages]
  30. Name: "chinesesimp"; MessagesFile: "compiler:Default.isl"

  31. ;资源文件 包括安装包必需的文件,如.dll、配置文件等
  32. [Files]
  33. Source: "F:\IT\IT.exe"; DestDir: "{app}"; Flags: ignoreversion

  34. [Messages]
  35. BeveledLabel=-----------------------------------------------------------------小小鸟制作
  36. ; 注意: 不要在任何共享系统文件上使用“Flags: ignoreversion”

  37. ;这里为检测.net2.0框架的代码,//判断程序是否存在//初始华程序事件

  38. [code]
  39. function InitializeSetup: Boolean;
  40. var Isbl: boolean; //声明变量
  41. var Isstr: string;
  42. //全局变量
  43. var MyProgChecked: Boolean;
  44. var Path:string ;
  45. ResultCode: Integer;
  46. begin
  47. if RegKeyExists(HKLM, 'SOFTWARE\Microsoft\.NETFramework\policy\v2.0') then
  48. begin
  49. Result := true;
  50. end
  51. else
  52. begin
  53. if MsgBox('系统检测到您没有安装.Net Framework2.0,是否立刻下载并安装?', mbConfirmation, MB_YESNO) = idYes then
  54. begin
  55. Path := ExpandConstant('{pf}\Internet Explorer\iexplore.exe');
  56. Exec(Path, 'http://data.zhiluo.net/soft/Microsoft_DotNet2.0.rar', '' , SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode);
  57. MsgBox('请安装好.Net Framework2.0环境后,再运行本安装包程序!',mbInformation,MB_OK);
  58. Result := false;
  59. end
  60. else
  61. begin
  62. MsgBox('没有安装.Net Framework2.0环境,无法运行程序,本安装程序即将退出!',mbInformation,MB_OK);
  63. Result := false;
  64. end;
  65. end;

  66. begin //开始
  67. Isbl := true; //变量赋值 注意下方的“SOFTWARE\IT_soft”要与安装时创建的注册表信息一致
  68. Isstr := '欢迎';
  69. if RegValueExists(HKEY_LOCAL_MACHINE, 'SOFTWARE\IT_soft', 'config') then
  70. begin
  71. MsgBox('软件已安装过,如果需要重新安装,请先卸载再安装!',mbConfirmation, MB_OK);
  72. isbl := false;
  73. end
  74. else
  75. begin
  76. //MsgBox('无值',mbConfirmation, MB_OK);
  77. isbl := true;
  78. end;
  79. Result := Isbl;
  80. end; //结束
  81. end;

  82. [Icons]
  83. ;Commonprograms 程序菜单
  84. ;Userdesktop 桌面
  85. ;Group程序菜单的文件夹里

  86. Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
  87. Name: "{group}\{cm:ProgramOnTheWeb,{#MyWebName}}"; Filename: "{#MyAppURL}"
  88. Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
  89. Name: "{userdesktop}\小小鸟软件"; Filename: "{app}\{#MyAppExeName}"; IconFilename: "{app}\logo.ico";

  90. ;用于在用户系统中创建,修改或删除注册表健值
  91. [Registry]
  92. Root: HKLM ;SubKey:"Software\IT_soft";ValueType:dword;ValueName:config;ValueData:10 ;Flags:uninsdeletevalue

  93. ;安装结束后要运行的选项,可选
  94. [Run]
  95. Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, "&", "&&")}}"; Flags: nowait postinstall skipifsilent
复制代码


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|手机版|Archiver|SgzyStudio

GMT+8, 2024-6-4 06:28 , Processed in 0.124185 second(s), 22 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表