论坛风格切换切换到宽版
  • 9265阅读
  • 26回复

请教老虎版主水波插件问题 [复制链接]

上一主题 下一主题
离线546242502
 

发帖
332
金钱
-3060
威望
-306
只看楼主 倒序阅读 0 发表于: 2015-09-08



老虎版主,请帮忙看下,插件这个问题怎么解决,选择英文没有问题,选择中文就出现如上的错误?不知道是哪里问题,下面这个例子把 Name: "chs",改成 Name: "cn",Name: "che" 等就没有问题,请教老虎版主问题的根本所在在哪里,我封包 Inno Setup 的脚本一直有这个问题,把 Name: "chs" 修改了,选择中文还是出现这个问题,所以想问一下老虎版主造成这个问题的根本所在?

代码:
  1. #define MyAppName "Inno Setup Suite"
  2. #define MyAppVersion "5"
  3. #define MyAppPublisher "jrsoftware.org"
  4. #define MyAppURL "http://www.jrsoftware.org/"
  5. #define MyAppExeName "Compil32.exe"
  6. [Setup]
  7. ; 注意: AppId 的值是唯一识别这个程序的标志。
  8. ; 不要在其他程序中使用相同的 AppId 值。
  9. ; (在编译器中点击菜单“工具 -> 产生 GUID”可以产生一个新的 GUID)
  10. AppId=Inno Setup {#MyAppVersion}
  11. AppName={#MyAppName}
  12. AppVersion={#MyAppVersion}
  13. AppVerName={#MyAppName} {#MyAppVersion}
  14. AppMutex={#MyAppName}
  15. AppPublisher={#MyAppPublisher}
  16. AppPublisherURL={#MyAppURL}
  17. AppSupportURL={#MyAppURL}
  18. AppUpdatesURL={#MyAppURL}
  19. DefaultDirName={pf}\Inno Setup {#MyAppVersion}
  20. DefaultGroupName={#MyAppName}
  21. OutputDir=安装程序
  22. OutputBaseFilename={#MyAppName} {#MyAppVersion}
  23. Compression=lzma
  24. SolidCompression=yes
  25. DirExistsWarning=no
  26. WizardImageFile=Image\开始位图1.bmp
  27. WizardSmallImageFile=Image\icon.bmp
  28. SetupIconFile=Image\Icon.ico
  29. [Languages]
  30. Name: "en"; MessagesFile: "compiler:Languages\English.isl"
  31. //Name: "chs"; MessagesFile: "compiler:Default.isl"
  32. Name: "chs"; MessagesFile: "compiler:Default.isl"
  33. [Files]
  34. //临时文件//
  35. Source: "Image\开始位图1.bmp"; Flags: dontcopy
  36. Source: "Image\结束位图1.bmp"; Flags: dontcopy
  37. Source: "Image\开始位图2.bmp"; Flags: dontcopy
  38. Source: "Image\结束位图2.bmp"; Flags: dontcopy
  39. Source: "waterctrl.dll"; Flags: dontcopy
  40. //第一部分//
  41. [CODE]
  42. var
  43. //水波效果
  44. bmp: TBitmap;
  45. bmp1: TBitmap;
  46. CheckBox1: TCheckBox;
  47. function enablewater(ParentWnd: HWND; Left, Top: integer; Bmp: HBITMAP; WaterRadius, WaterHeight: integer): BOOL;
  48.   external 'enablewater@files:waterctrl.dll stdcall';
  49. function waterblob(x, y: integer; radius, height: integer): BOOL;
  50.   external 'waterblob@files:waterctrl.dll stdcall';
  51. function flattenwater(): BOOL; external 'flattenwater@files:waterctrl.dll stdcall';
  52. function disablewater(): BOOL; external 'disablewater@files:waterctrl.dll stdcall';
  53. function setwaterparent(ParentWnd: HWND): BOOL; external 'setwaterparent@files:waterctrl.dll stdcall';
  54. //水波效果
  55. procedure InitializeWizard();
  56. var
  57. i: integer;
  58. begin
  59.   CreateMutex('{#MyAppName}');
  60.   //设置安装向导左边位图
  61.   WizardForm.WizardSmallBitmapImage.width:=55; //设置页眉图片的大小
  62.   WizardForm.WizardSmallBitmapImage.height:=55;
  63.   WizardForm.WizardSmallBitmapImage.left:=WizardForm.width-65; //设置左边页眉留出的空隙
  64.   WizardForm.WizardSmallBitmapImage.top:=0;
  65.   //设置标签位置
  66.   WizardForm.BeveledLabel.Left:=25;
  67.   if ActiveLanguage = 'chs' then
  68.   begin
  69.   ExtractTemporaryFile('开始位图1.bmp');
  70.   ExtractTemporaryFile('结束位图1.bmp');
  71.   bmp := TBitmap.create;
  72.   bmp.LoadFromFile(ExpandConstant('{tmp}\开始位图1.bmp'));
  73.   bmp1 := TBitmap.create;
  74.   bmp1.LoadFromFile(ExpandConstant('{tmp}\结束位图1.bmp'));
  75.   Wizardform.WelcomeLabel1.Visible:= false;  //   屏蔽安装向导页面上面的文字
  76.   Wizardform.WelcomeLabel2.Visible:= false;  //   屏蔽安装向导页面上面的文字
  77.   Wizardform.WizardBitmapImage.Width:= Wizardform.InnerPage.Width;  // 放大图像到整个界面宽度
  78.   Wizardform.WizardBitmapImage.Height:= Wizardform.InnerPage.Height;
  79.   enablewater(WizardForm.WelcomePage.Handle, 0, 0, bmp.Handle, 3, 50);
  80.   end;
  81.   if ActiveLanguage <> 'chs' then
  82.   begin
  83.   ExtractTemporaryFile('开始位图2.bmp');
  84.   ExtractTemporaryFile('结束位图2.bmp');
  85.   bmp := TBitmap.create;
  86.   bmp.LoadFromFile(ExpandConstant('{tmp}\开始位图2.bmp'));
  87.   bmp1 := TBitmap.create;
  88.   bmp1.LoadFromFile(ExpandConstant('{tmp}\结束位图2.bmp'));
  89.   Wizardform.WelcomeLabel1.Visible:= false;  //   屏蔽安装向导页面上面的文字
  90.   Wizardform.WelcomeLabel2.Visible:= false;  //   屏蔽安装向导页面上面的文字
  91.   Wizardform.WizardBitmapImage.Width:= Wizardform.InnerPage.Width;  // 放大图像到整个界面宽度
  92.   Wizardform.WizardBitmapImage.Height:= Wizardform.InnerPage.Height;
  93.   enablewater(WizardForm.WelcomePage.Handle, 0, 0, bmp.Handle, 3, 50);
  94.   end;
  95. end;
  96. procedure CurPageChanged(CurPage: Integer);
  97. begin
  98.   if CurPage = wpWelcome then
  99.   begin
  100.     setwaterparent(WizardForm.WelcomePage.Handle);
  101.     waterblob(70, 198, 10, 1000);
  102.   end else
  103.   if CurPage = wpFinished then
  104.   begin
  105.     setwaterparent(WizardForm.FinishedPage.Handle);
  106.     waterblob(70, 198, 10, 1000);
  107.   end else
  108.     flattenwater();
  109. end;
  110. procedure DeinitializeSetup();
  111. begin
  112.   disablewater();
  113.   bmp.Free;
  114.   bmp1.Free;
  115. end;

附件: Desktop.zip (338 K) 下载次数:8
离线546242502

发帖
332
金钱
-3060
威望
-306
只看该作者 1 发表于: 2015-09-08
顺便请教老虎版主,这个帖子的问题 :http://bbs.hanzify.org/read-htm-tid-98592.html

如果实现 A 关联 B 系列,选择 A  则选中 B 系列,但是 B 系列不和 A  的选中强制关联,A 选中后,B系列选中,且能取消选中 B 或其子项,且 A 还是选中状态!

还有就是这个帖子:
http://bbs.hanzify.org/read-htm-tid-98595-ds-1.html

由于在卸载时需要判断组件是否选择,再进行操作,但是到
if CurUninstallStep = usPostUninstall then
时,已经找不到组件信息了,所以会弹出错误提示,但是使用
usUninstall 会造成误删,怎么实现点击卸载按钮后才删除,不知道怎么做?
离线gnatix

发帖
7696
金钱
-8279
威望
-828
只看该作者 2 发表于: 2015-09-09
关于水纹的问题:跟语言选择毫无关系。你那个 “开始位图1.bmp” 文件是有问题的,可能不是标准的 bmp 文件。你换一个位图文件试试看。


离线gnatix

发帖
7696
金钱
-8279
威望
-828
只看该作者 3 发表于: 2015-09-09
关于:由于在卸载时需要判断组件是否选择,再进行操作,但是到
if CurUninstallStep = usPostUninstall then
时,已经找不到组件信息了,所以会弹出错误提示,但是使用
usUninstall 会造成误删,怎么实现点击卸载按钮后才删除,不知道怎么做?

定义一个全局变量,在 usUninstall 时检查是否有某个组件,并且将检查结果保存到所定义的全局变量中。在 usPostUninstall 时就不要检查组件了,只要读取全局变量的值就可以达到同样的目录。下面以那个删除 Hosts 的代码为例:

var
   TaskSelected: boolean;

procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep );
begin          
  if CurUninstallStep = usUninstall then           // 卸载文件前检查安装时是否选择了任务
   TaskSelected := WasTaskSelected('noad', '{#emit SetupSetting("AppId")}');
  if CurUninstallStep = usPostUninstall then       // 卸载文件后运行
    if TaskSelected then    
      begin
        StartRemoveHosts;                             // 开始删除项目(必需)
        RemoveHosts('127.0.0.1 www.abcd.com');        // 添加要删除的项目
        RemoveHosts('127.0.0.1 www.abcd.net');        // 添加要删除的项目
        EndRemoveHosts;                               // 结束删除项目(必需)
      end;
end;

离线我爱你

发帖
22
金钱
220
威望
22
只看该作者 4 发表于: 2015-09-09
回 3楼(gnatix) 的帖子
请教虎版,这样的水波效果实现了为什么无法正常显示右下角自定义链接的效果。自定义添加的类似关于按钮无法正常显示,可有解救方法。或者麻烦版主贴一下能使用的代码,让小弟参考学习。谢谢。
离线546242502

发帖
332
金钱
-3060
威望
-306
只看该作者 5 发表于: 2015-09-09
回 2楼(gnatix) 的帖子
老虎版主,好像不是那张图像的问题额,换了几次,我这里还是出现问题:




问题: Desktop.zip (335 K) 下载次数:3
离线546242502

发帖
332
金钱
-3060
威望
-306
只看该作者 6 发表于: 2015-09-09
回 3楼(gnatix) 的帖子
gnatix:关于:由于在卸载时需要判断组件是否选择,再进行操作,但是到if CurUninstallStep = usPostUninstall then时,已经找不到组件信息了,所以会弹出错误提示,但是使用usUninstall 会造成误删,怎么实现点击 .. (2015-09-09 03:48)

当时想到这方法了,不过一转念就忘了,感谢老虎版主指点,知道怎么解决了。

测试了,不过在多语言多组件多安装路径这样还是比先前的办法麻烦许多。
离线我爱你

发帖
22
金钱
220
威望
22
只看该作者 7 发表于: 2015-09-09
回 6楼(546242502) 的帖子
546242502:当时想到这方法了,不过一转念就忘了,感谢老虎版主指点,知道怎么解决了。[表情]测试了,不过在多语言多组件多安装路径这样还是比先前的办法麻烦许多。 (2015-09-09 14:39) 

大神,这样的水波效果实现了为什么无法正常显示右下角自定义链接的效果。自定义添加的类似关于按钮无法正常显示,可有解救方法。或者麻烦贴一下能使用的代码,让小弟参考学习。谢谢。
离线546242502

发帖
332
金钱
-3060
威望
-306
只看该作者 8 发表于: 2015-09-09
回 7楼(我爱你) 的帖子
一切正常,哪里不能显示了:



代码:
  1. #define MyAppName "Inno Setup Suite"
  2. #define MyAppVersion "5"
  3. #define MyAppPublisher "jrsoftware.org"
  4. #define MyAppURL "http://www.jrsoftware.org/"
  5. #define MyAppExeName "Compil32.exe"
  6. [Setup]
  7. ; 注意: AppId 的值是唯一识别这个程序的标志。
  8. ; 不要在其他程序中使用相同的 AppId 值。
  9. ; (在编译器中点击菜单“工具 -> 产生 GUID”可以产生一个新的 GUID)
  10. AppId=Inno Setup {#MyAppVersion}
  11. AppName={#MyAppName}
  12. AppVersion={#MyAppVersion}
  13. AppVerName={#MyAppName} {#MyAppVersion}
  14. AppMutex={#MyAppName}
  15. AppPublisher={#MyAppPublisher}
  16. AppPublisherURL={#MyAppURL}
  17. AppSupportURL={#MyAppURL}
  18. AppUpdatesURL={#MyAppURL}
  19. DefaultDirName={pf}\Inno Setup {#MyAppVersion}
  20. DefaultGroupName={#MyAppName}
  21. OutputDir=安装程序
  22. OutputBaseFilename={#MyAppName} {#MyAppVersion}
  23. Compression=lzma
  24. SolidCompression=yes
  25. DirExistsWarning=no
  26. ChangesAssociations=yes
  27. WizardImageFile=Image\开始位图1.bmp
  28. WizardSmallImageFile=Image\icon.bmp
  29. SetupIconFile=Image\Icon.ico
  30. //版本信息
  31. VersionInfoCompany=jrsoftware.org
  32. VersionInfoDescription=Inno Setup Hl {#MyAppVersion} Setup
  33. VersionInfoVersion={#MyAppVersion}
  34. [Languages]
  35. Name: "en"; MessagesFile: "compiler:Languages\English.isl"
  36. [Files]
  37. //临时文件//
  38. Source: "Image\开始位图1.bmp"; Flags: dontcopy
  39. Source: "Image\结束位图1.bmp"; Flags: dontcopy
  40. Source: "Image\开始位图2.bmp"; Flags: dontcopy
  41. Source: "Image\结束位图2.bmp"; Flags: dontcopy
  42. Source: "waterctrl.dll"; Flags: dontcopy
  43. [CODE]
  44. var
  45. //水波效果
  46. bmp: TBitmap;
  47. bmp1: TBitmap;
  48. function enablewater(ParentWnd: HWND; Left, Top: integer; Bmp: HBITMAP; WaterRadius, WaterHeight: integer): BOOL;
  49.   external 'enablewater@files:waterctrl.dll stdcall';
  50. function waterblob(x, y: integer; radius, height: integer): BOOL;
  51.   external 'waterblob@files:waterctrl.dll stdcall';
  52. function flattenwater(): BOOL; external 'flattenwater@files:waterctrl.dll stdcall';
  53. function disablewater(): BOOL; external 'disablewater@files:waterctrl.dll stdcall';
  54. function setwaterparent(ParentWnd: HWND): BOOL; external 'setwaterparent@files:waterctrl.dll stdcall';
  55. //水波效果
  56. procedure AboutButtonOnClick(Sender: TObject);
  57. begin
  58.   MsgBox('This is the about message!', mbInformation, mb_Ok);
  59. end;
  60. procedure InitializeWizard();
  61. var
  62. i: integer;
  63. AboutButton: TNewButton;
  64. begin
  65.   // create an instance of the button and assign it to the local variable AboutButton
  66.   AboutButton := TNewButton.Create(WizardForm);
  67.   // set the parent to the just created button control
  68.   AboutButton.Parent := WizardForm;
  69.   // adjust the position to the created button control; it gets the horizontal indent
  70.   // by the right indent of the Cancel button; the vertical position as well as width
  71.   // and height are the same as the Cancel button has
  72.   AboutButton.Left := WizardForm.ClientWidth - WizardForm.CancelButton.Left -
  73.     WizardForm.CancelButton.Width;
  74.   AboutButton.Top := WizardForm.CancelButton.Top;
  75.   AboutButton.Width := WizardForm.CancelButton.Width;
  76.   AboutButton.Height := WizardForm.CancelButton.Height;
  77.   // set its caption
  78.   AboutButton.Caption := '&About';
  79.   // and assign the AboutButtonOnClick method to the OnClick event of the button
  80.   AboutButton.OnClick := @AboutButtonOnClick;
  81.   CreateMutex('{#MyAppName}');
  82.   //设置安装向导左边位图
  83.   WizardForm.WizardSmallBitmapImage.width:=55; //设置页眉图片的大小
  84.   WizardForm.WizardSmallBitmapImage.height:=55;
  85.   WizardForm.WizardSmallBitmapImage.left:=WizardForm.width-65; //设置左边页眉留出的空隙
  86.   WizardForm.WizardSmallBitmapImage.top:=0;
  87.   //设置标签位置
  88.   WizardForm.BeveledLabel.Left:=25;
  89.   if ActiveLanguage = 'cn' then
  90.   begin
  91.   ExtractTemporaryFile('开始位图1.bmp');
  92.   ExtractTemporaryFile('结束位图1.bmp');
  93.   bmp := TBitmap.create;
  94.   bmp.LoadFromFile(ExpandConstant('{tmp}\开始位图1.bmp'));
  95.   bmp1 := TBitmap.create;
  96.   bmp1.LoadFromFile(ExpandConstant('{tmp}\结束位图1.bmp'));
  97.   Wizardform.WelcomeLabel1.Visible:= false;  //   屏蔽安装向导页面上面的文字
  98.   Wizardform.WelcomeLabel2.Visible:= false;  //   屏蔽安装向导页面上面的文字
  99.   Wizardform.WizardBitmapImage.Width:= Wizardform.InnerPage.Width;  // 放大图像到整个界面宽度
  100.   Wizardform.WizardBitmapImage.Height:= Wizardform.InnerPage.Height;
  101.   enablewater(WizardForm.WelcomePage.Handle, 0, 0, bmp.Handle, 3, 50);
  102.   end;
  103.   if ActiveLanguage <> 'cn' then
  104.   begin
  105.   ExtractTemporaryFile('开始位图2.bmp');
  106.   ExtractTemporaryFile('结束位图2.bmp');
  107.   bmp := TBitmap.create;
  108.   bmp.LoadFromFile(ExpandConstant('{tmp}\开始位图2.bmp'));
  109.   bmp1 := TBitmap.create;
  110.   bmp1.LoadFromFile(ExpandConstant('{tmp}\结束位图2.bmp'));
  111.   Wizardform.WelcomeLabel1.Visible:= false;  //   屏蔽安装向导页面上面的文字
  112.   Wizardform.WelcomeLabel2.Visible:= false;  //   屏蔽安装向导页面上面的文字
  113.   Wizardform.WizardBitmapImage.Width:= Wizardform.InnerPage.Width;  // 放大图像到整个界面宽度
  114.   Wizardform.WizardBitmapImage.Height:= Wizardform.InnerPage.Height;
  115.   enablewater(WizardForm.WelcomePage.Handle, 0, 0, bmp.Handle, 3, 50);
  116.   end;
  117. end;
  118. procedure CurPageChanged(CurPage: Integer);
  119. begin
  120.   if CurPage = wpWelcome then
  121.   begin
  122.     setwaterparent(WizardForm.WelcomePage.Handle);
  123.     waterblob(70, 198, 10, 1000);
  124.   end else
  125.   if CurPage = wpFinished then
  126.   begin
  127.     setwaterparent(WizardForm.FinishedPage.Handle);
  128.     waterblob(70, 198, 10, 1000);
  129.   end else
  130.     flattenwater();
  131. end;
  132. procedure DeinitializeSetup();
  133. begin
  134.   disablewater();
  135.   bmp.Free;
  136.   bmp1.Free;
  137. end;


离线gnatix

发帖
7696
金钱
-8279
威望
-828
只看该作者 9 发表于: 2015-09-10
回 4楼(我爱你) 的帖子
我爱你:请教虎版,这样的水波效果实现了为什么无法正常显示右下角自定义链接的效果。自定义添加的类似关于按钮无法正常显示,可有解救方法。或者麻烦版主贴一下能使用的代码,让小弟参考学习。 .. (2015-09-09 13:20)

水波效果和自定义链接效果两者相互没有关系的,当然相互不会影响。下面给你一个精简的脚步。

[Setup]
AppName=My Program
AppVersion=1.5
DefaultDirName={pf}\My Program
DefaultGroupName=My Program

[Files]
Source: "开始位图.bmp"; Flags: dontcopy
Source: "waterctrl.dll"; Flags: dontcopy

[CODE]
var
  bmp: TBitmap;
  AboutButton: TLabel;

function enablewater(ParentWnd: HWND; Left, Top: integer; Bmp: HBITMAP; WaterRadius, WaterHeight: integer): BOOL;
  external 'enablewater@files:waterctrl.dll stdcall';
function waterblob(x, y: integer; radius, height: integer): BOOL;
  external 'waterblob@files:waterctrl.dll stdcall';
function flattenwater(): BOOL; external 'flattenwater@files:waterctrl.dll stdcall';
function disablewater(): BOOL; external 'disablewater@files:waterctrl.dll stdcall';
function setwaterparent(ParentWnd: HWND): BOOL; external 'setwaterparent@files:waterctrl.dll stdcall';

procedure AboutButtonOnClick(Sender: TObject);
begin
  MsgBox('这是你的说明...', mbInformation, MB_OK);
end;

procedure AboutButtonOnMouseEnter(Sender: TObject);
begin
  AboutButton.Font.Style := [fsBold];
end;

procedure AboutButtonOnMouseLeave(Sender: TObject);
begin
  AboutButton.Font.Style := [];
end;

procedure InitializeWizard();
var
  CancelButton: TButton;
begin
  ExtractTemporaryFile('开始位图.bmp');
  bmp := TBitmap.create;
  bmp.LoadFromFile(ExpandConstant('{tmp}\开始位图.bmp'));
  Wizardform.WelcomeLabel1.Visible:= false;  //   屏蔽安装向导页面上面的文字
  Wizardform.WelcomeLabel2.Visible:= false;  //   屏蔽安装向导页面上面的文字
  Wizardform.WizardBitmapImage.Width:= Wizardform.InnerPage.Width;  // 放大图像到整个界面宽度
  Wizardform.WizardBitmapImage.Height:= Wizardform.InnerPage.Height;
  enablewater(WizardForm.WelcomePage.Handle, 0, 0, bmp.Handle, 3, 50);
  //
  CancelButton := WizardForm.CancelButton;
  AboutButton := TLabel.Create(WizardForm);
  AboutButton.Parent := WizardForm;
  AboutButton.Left := WizardForm.ClientWidth - CancelButton.Left - CancelButton.Width;
  AboutButton.Top := CancelButton.Top;
  AboutButton.Width := CancelButton.Width;
  AboutButton.Height := CancelButton.Height;
  AboutButton.Caption := '关于(&A)...';
  AboutButton.OnClick := @AboutButtonOnClick;
  AboutButton.Font.Color := clBlue;
  AboutButton.Cursor := crHand;
  AboutButton.OnMouseEnter := @AboutButtonOnMouseEnter;
  AboutButton.OnMouseLeave := @AboutButtonOnMouseLeave;
end;

procedure CurPageChanged(CurPage: Integer);
begin
  if CurPage = wpWelcome then
    begin
      setwaterparent(WizardForm.WelcomePage.Handle);
      waterblob(70, 198, 10, 1000);
    end
  else if CurPage = wpFinished then
    begin
      setwaterparent(WizardForm.FinishedPage.Handle);
      waterblob(70, 198, 10, 1000);
    end else
      flattenwater();
end;

procedure DeinitializeSetup();
begin
  disablewater();
  bmp.Free;
end;