Inno setup 如何限制用户输入目录编辑框?

Inno setup 如何限制用户输入目录编辑框?,inno-setup,Inno Setup,我需要防止用户在目录编辑框中输入的路径末尾输入 例如,路径不能为: C:\Program Files\InnoSetup. 如何验证目录编辑框输入,或者如何防止用户将输入到路径末尾?要自动删除目标目录末尾的所有点,可以使用此脚本。你还没有回答我的问题,当在路径的末端发现一个点时,你想做什么,所以我选择了这种方式来显示。请注意,这将删除文件夹字符串末尾的所有点,因此将从以下路径中删除: C:\Program Files (x86)\My Program..... 此脚本使: C:\Progra

我需要防止用户在目录编辑框中输入的路径末尾输入

例如,路径不能为:

C:\Program Files\InnoSetup.

如何验证目录编辑框输入,或者如何防止用户将
输入到路径末尾?

要自动删除目标目录末尾的所有点,可以使用此脚本。你还没有回答我的问题,当在路径的末端发现一个点时,你想做什么,所以我选择了这种方式来显示。请注意,这将删除文件夹字符串末尾的所有点,因此将从以下路径中删除:

C:\Program Files (x86)\My Program.....
此脚本使:

C:\Program Files (x86)\My Program
以下是脚本:

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

[code]
procedure OnDirEditChange(Sender: TObject);
var
  S: string;
begin
  S := WizardDirValue;
  if (Length(S) > 0) and (S[Length(S)] = '.') then
  begin
    MsgBox('Last char(s) of the entered target folder is "."' + #13#10 +
      'All "." chars from the end will be deleted!', mbInformation, MB_OK);
    while (Length(S) > 0) and (S[Length(S)] = '.') do
      Delete(S, Length(S), 1);
    WizardForm.DirEdit.Text := S;
  end;
end;

procedure InitializeWizard;
begin  
  WizardForm.DirEdit.OnChange := @OnDirEditChange;
end;

procedure CurPageChanged(CurPageID: Integer);
begin
  // this is just a paranoid event trigger, in case the DefaultDirName
  // would be able to contain dots at the end, what can't at this time
  if CurPageID = wpSelectDir then
    OnDirEditChange(nil);
end;

当然还有其他验证路径的方法,例如,您可以让用户在最后输入带点的路径,并在您进入向导的下一步时进行验证等。但您只是没有指定如何编写验证问题的含义。

您想做什么,何时在路径的末尾找到
?您想自动删除它,禁用“下一步”按钮,还是仅仅通知用户并让安装继续,或者其他什么?