杉宫竹苑工作室

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

Inno Setup 可选磁盘安装路劲

[复制链接]
发表于 2017-3-6 17:23:29 | 显示全部楼层 |阅读模式

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

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

x
  1. [Code]
  2. function GetDriveType(lpDisk: String): integer;
  3. external 'GetDriveTypeW@kernel32.dll stdcall';
  4. procedure GetAllHDDrives(var aos: TArrayOfString);
  5. var i, n: integer;
  6.     drv: string;
  7. begin
  8.   SetArrayLength(aos, 0);
  9.   For i:= 3 to 26 do                   //从 C: 盘一直检查到 Z: 盘
  10.     begin
  11.       drv:= chr(i+64)+':\';
  12.       if GetDriveType(drv) = 3 then      //只处理硬盘(Type = 3)
  13.         begin
  14.           n := GetArrayLength(aos);
  15.           SetArrayLength(aos, n+1);
  16.           aos[n] := drv;
  17.         end;
  18.     end;
  19. end;
  20. var
  21.   NewComboBox1: TNewComboBox;
  22. procedure InitializeWizard();
  23. var i: Integer;
  24.     ListAllDrv: TArrayOfString;
  25. begin
  26.   GetAllHDDrives(ListAllDrv);
  27.   WizardForm.DirBrowseButton.Visible := False;
  28.   WizardForm.DirEdit.Visible := False;
  29.   NewComboBox1 := TNewComboBox.Create(WizardForm);
  30.   with NewComboBox1 do
  31.   begin
  32.     Parent := WizardForm.SelectDirPage;
  33.     Left := ScaleX(0);
  34.     Top := ScaleY(63);
  35.     Width := ScaleX(417);
  36.     Height := ScaleY(20);
  37.     Text := '<选择一个安装目录>';
  38.     For i := 0 to Length(ListAllDrv)-1 do
  39.       Items.Add(ListAllDrv[i] + 'Program Files\XYZ')
  40.   end;
  41. end;
  42. function NextButtonClick(CurPageID: Integer): Boolean;
  43. begin
  44. result:= true;
  45. if CurPageID = wpSelectDir then
  46.   if NewComboBox1.Text = '<选择一个安装目录>' then
  47.     result:= false
  48.   else
  49.     WizardForm.DirEdit.Text := NewComboBox1.Text;
  50. end;
复制代码
48_377_cc48b4451472436.gif
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-19 17:15 , Processed in 0.118427 second(s), 21 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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