gpt4 book ai didi

inno-setup - 在某些具有隐藏 UserInfoPage Inno Setup 页面的机器上获取 "You must enter a name"和 "Cannot focus a disabled or invisible window"

转载 作者:行者123 更新时间:2023-12-04 17:08:05 26 4
gpt4 key购买 nike

我做了一个快速安装程序,在一些 PC 上安装时我发现了问题。我有“序列号”系统,当我按“下一步”时它给我一个错误

You must enter a name

然后:

Cannot focus a disabled or invisible window

但在许多其他具有相同 SO 的 PC 中,这工作正常。这是我正在使用的代码:

[Setup]
WizardStyle=modern
UserInfoPage=yes

[Code]

procedure CurPageChanged(CurPageID: Integer);
begin
if CurPageID = wpUserInfo then begin
WizardForm.UserInfoOrgLabel.Hide();
WizardForm.UserInfoOrgEdit.Hide();
WizardForm.UserInfoNameLabel.Hide();
WizardForm.UserInfoNameEdit.Hide();
end;
end;

// Presence of the CheckSerial event function displays the serial number box.
// But here we accept any non-empty serial.
// We will validate it only in the NextButtonClick,
// as the online validation can take long.
function CheckSerial(Serial: String): Boolean;
begin
Result := (Serial <> '');
end;

function NextButtonClick(CurPageID: Integer): Boolean;
var
WinHttpReq: Variant;
Url: string;
begin
Result := True;
if CurPageID = wpUserInfo then
begin
WinHttpReq := CreateOleObject('WinHttp.WinHttpRequest.5.1');
Url := 'Link that i use to check the serial number' +
WizardForm.UserInfoSerialEdit.Text;
WinHttpReq.Open('GET', Url, False);
WinHttpReq.Send('');
// Depending on implementation of the server,
// use either HTTP status code (.Status)
// or contents of returned "page" (.ResponseText)
// Here we use the HTTP status code:
// 200 = serial is valid, anything else = serial is invalid,
// and when invalid, we display .ResponseText
Result := (WinHttpReq.Status = 200);
if not Result then
MsgBox(WinHttpReq.ResponseText, mbError, MB_OK);
end;
end;

最佳答案

启用UserInfoPage 后,必须填写“用户名” 框。该框预先填充了 RegisteredOwner 注册表值。如果该值恰好为空,因此该框为空,则您无法离开该页面,除非您手动填写它。您收到“您必须输入名称” 错误,Inno Setup 将焦点移至该框。失败并显示“无法聚焦禁用或不可见的窗口”,因为您隐藏了该框。

如果您不关心用户名,只需填写一些虚拟值:

WizardForm.UserInfoNameEdit.Text := 'foo';

关于inno-setup - 在某些具有隐藏 UserInfoPage Inno Setup 页面的机器上获取 "You must enter a name"和 "Cannot focus a disabled or invisible window",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70088581/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com