杉宫竹苑工作室

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

类似 NSIS 组件列表描述控制的 Inno Setup 插件

[复制链接]
发表于 2016-12-31 13:20:59 | 显示全部楼层 |阅读模式

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

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

x
组件类似NSIS的效果。

32008460610.gif
i2008460617.gif
  1. ; -- Example1.iss --
  2. ; restools
  3. ; http://restools.hanzify.org
  4. ; 看见很多人需要,就整个出来爽爽吧
  5. ; 时间仓促,所以编程可能会有点谬误,如有错误可以提出
  6. ; descctrl.dll 为一个 6.5 KB 的组件描述插件

  7. [Setup]
  8. AppName=My Program
  9. AppVerName=My Program version 1.5
  10. DefaultDirName={pf}\My Program
  11. DefaultGroupName=My Program
  12. UninstallDisplayIcon={app}\MyProg.exe

  13. [Components]
  14. Name: "program"; Description: "程序文件"; Types: full compact custom; Flags: fixed
  15. Name: "help"; Description: "帮助文件"; Types: full
  16. Name: "readme"; Description: "自述文件"; Types: full
  17. Name: "readme\en"; Description: "英文"; Flags: exclusive
  18. Name: "readme\de"; Description: "德文"; Flags: exclusive
  19. Name: "readme\cn"; Description: "中文"; Flags: exclusive
  20. Name: "readme\ru"; Description: "俄文"; Flags: exclusive
  21. Name: "test"; Description: "测试"; Types: full
  22. Name: "test\test1"; Description: "测试1"; Flags: checkablealone
  23. Name: "test\test2"; Description: "测试2"; Flags: checkablealone
  24. Name: "test\test3"; Description: "测试3"; Flags: checkablealone
  25. Name: "test\test4"; Description: "测试4"; Flags: checkablealone
  26. Name: "test\test5"; Description: "测试5"; Flags: checkablealone
  27. Name: "test\test6"; Description: "测试6"; Flags: checkablealone

  28. [Files]
  29. Source: "MyProg.exe"; DestDir: "{app}"; Components: program
  30. Source: "MyProg.chm"; DestDir: "{app}"; Components: help
  31. Source: "descctrl.dll"; Flags: dontcopy

  32. [Icons]
  33. Name: "{group}\My Program"; Filename: "{app}\MyProg.exe"

  34. [Code]
  35. function enabledesc(ComponentsListHandle: HWND; DescLabelHandle: HWND; DescStrings: PChar): BOOL; external 'enabledesc@files:descctrl.dll stdcall';
  36. //ComponentsListHandle 组件框句柄
  37. //DescLabelHandle 描述TNewStaticText句柄
  38. //DescStrings 描述文字 英文分号分割“;”,如果描述中必须要有英文分号,请用“#3B”代替。

  39. function disabledesc(): BOOL; external 'disabledesc@files:descctrl.dll stdcall';

  40. var
  41.   Info: TNewStaticText;
  42.   InfoCaption: TNewStaticText;
  43.   InfoPanel: TPanel;

  44. procedure DeinitializeSetup();
  45. begin
  46.   //释放描述控制
  47.   disabledesc();
  48. end;

  49. procedure InitializeWizard();
  50. begin
  51.   // 调整组件列表的大小
  52.   WizardForm.TYPESCOMBO.Visible:= false;
  53.   WizardForm.ComponentsList.Height := WizardForm.ComponentsList.Height + WizardForm.ComponentsList.Top - WizardForm.TYPESCOMBO.Top;
  54.   WizardForm.ComponentsList.Top := WizardForm.TYPESCOMBO.Top;
  55.   WizardForm.ComponentsList.Width := ScaleX(200);
  56.   //创建一个虚拟的GroupBox,因为Inno Setup 没有啊。
  57.   InfoPanel := TPanel.Create(WizardForm);
  58.   InfoPanel.Parent := WizardForm.SelectComponentsPage;
  59.   InfoPanel.Caption := '';
  60.   InfoPanel.Top := WizardForm.ComponentsList.Top;
  61.   InfoPanel.Left := ScaleX(216);
  62.   InfoPanel.Width := ScaleX(200);
  63.   InfoPanel.Height := WizardForm.ComponentsList.Height;
  64.   InfoPanel.BevelInner := bvRaised;
  65.   InfoPanel.BevelOuter := bvLowered;
  66.   InfoCaption := TNewStaticText.Create(WizardForm);
  67.   InfoCaption.Parent := WizardForm.SelectComponentsPage;
  68.   InfoCaption.Caption := '描述';
  69.   InfoCaption.Left := ScaleX(224);
  70.   InfoCaption.Top := InfoPanel.Top - ScaleY(5);
  71.   InfoCaption.Font.Color := clActiveCaption;
  72.   // 创建描述文字
  73.   Info := TNewStaticText.Create(WizardForm);
  74.   Info.Parent := InfoPanel;
  75.   Info.AutoSize := False;
  76.   Info.Left := ScaleX(6);
  77.   Info.Width := ScaleX(188);
  78.   Info.Top := ScaleY(12);
  79.   Info.Height := WizardForm.ComponentsList.Height - ScaleY(18);
  80.   Info.Caption := '移动你的鼠标指针到组件之上,便可见到它的描述。';
  81.   Info.WordWrap := true;
  82.   //激活描述控制
  83.   enabledesc(WizardForm.ComponentsList.Handle,Info.Handle,
  84.        '程序文件描述;'+
  85.        '帮助文件描述;'+
  86.        '自述文件描述;'+
  87.        '英文描述;'+
  88.        '德文描述;'+
  89.        '中文描述;'+
  90.        '俄文描述测试#3B#3B包含#3B英文分号;'+
  91.        '测试描述;'+
  92.        '测试1描述;'+
  93.        '测试2描述;'+
  94.        '测试3描述;'+
  95.        '测试4描述;'+
  96.        '测试5描述;'+
  97.        '测试6描述;'
  98.        );
  99. end;
复制代码


回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-19 18:43 , Processed in 0.118040 second(s), 21 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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