gpt4 book ai didi

forms - InnoSetup : Is it possible to open my custom Delphi form (from the DLL) instead of the standard setup wizard

转载 作者:行者123 更新时间:2023-12-03 15:05:48 27 4
gpt4 key购买 nike

我需要使用自己的组件(有点像 OneClick 安装程序)创建一个复杂的表单,并将其用作标准 InnoSetup 向导的替代品。可能吗?

我的表单被放入DLL中,这个DLL将可供InnoSetup进程使用。

这就是我尝试这样做的方法:

Delphi DLL代码

library OneClickWizard;

uses
SysUtils,
Classes,
Wizard in 'Wizard.pas' {FormWizard};

{$R *.res}

exports
CreateWizardForm,
DestroyWizardForm;

begin
end.

德尔菲形式

unit Wizard;

interface

type
TFormWizard = class(TForm)
private
{ Private declarations }
public
{ Public declarations }
end;

var
FormWizard: TFormWizard;

procedure CreateWizardForm(AppHandle: THandle); stdcall;
procedure DestroyWizardForm; stdcall;

implementation

{$R *.dfm}

procedure CreateWizardForm(AppHandle: THandle);
begin
Application.Handle := AppHandle;
FormWizard := TFormWizard.Create(Application);
FormWizard.Show;
FormWizard.Refresh;
end;

procedure DestroyWizardForm;
begin
FormWizard.Free;
end;

InnoSetup 脚本 (iss)

[Setup]
;Disable all of the default wizard pages
DisableDirPage=yes
DisableProgramGroupPage=yes
DisableReadyMemo=true
DisableReadyPage=true
DisableStartupPrompt=true
DisableWelcomePage=true
DisableFinishedPage=true

[Files]
Source:"OneClickWizard.dll"; Flags: dontcopy

[Code]
procedure CreateWizardForm(AppHandle: Cardinal);
external 'CreateWizardForm@files:OneClickWizard.dll stdcall';
procedure DestroyWizardForm;
external 'DestroyWizardForm@files:OneClickWizard.dll stdcall';


procedure InitializeWizard();
begin
CreateWizardForm(MainForm.Handle);
end;

表单出现在屏幕上,但它对我的输入没有反应。似乎它超出了主消息周期。如何正确执行此操作?

最佳答案

在我的设置中我做了类似的事情。InnoSetup 代码我将句柄传递为 StrToInt(ExpandConstant('{wizardhwnd}')) (我的猜测是 MainForm.Handle 为零)

在DLL中:

OldAppHandle := Application.Handle;
try
Application.Handle := hAppHandle; // hAppHandle the handle from InnoSetup
F := TfmZForm.Create(Application);
try
F.Caption := lpTitle;
F.ShowModal;
Result := F.ErrorCode;
finally
F.Free;
end;
finally
Application.Handle := OldAppHandle;
end;

关于forms - InnoSetup : Is it possible to open my custom Delphi form (from the DLL) instead of the standard setup wizard,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8586403/

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