InnoSetup:可以打开我的自定义Delphi窗体(从DLL)而不是标准设置向导 [英] InnoSetup: Is it possible to open my custom Delphi form (from the DLL) instead of the standard setup wizard

查看:199
本文介绍了InnoSetup:可以打开我的自定义Delphi窗体(从DLL)而不是标准设置向导的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I need to create a complex form with my own components (kinda OneClick installer), and use it as the replacement of the standard InnoSetup wizard. Is it possible?

我的表单被放置到DLL中,此DLL将可用于InnoSetup进程。

My form is placed into DLL, and this DLL will be available for InnoSetup process.

这是我如何做到这一点:

This is how I tried to do that:

Delphi DLL代码

library OneClickWizard;

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

{$R *.res}

exports
  CreateWizardForm,
  DestroyWizardForm;

begin
end.

Delphi表单

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;

屏幕上显示的表单,但不对我的输入做出反应。似乎是主要的消息周期。如何正确执行?

The form appearing on the screen, but it doesn't react on my input. Seems it is out of main message cycle. How to do this correctly?

推荐答案

我完全不了解InnoSetup,但肯定需要使用ShowModal而不是在这里显示。安装UI总是模态的,你想要的是等到用户在返回到Inno之前完成与表单的复制。否则,Inno如何知道何时进行? ShowModal运行一个消息循环来为表单提供服务,所以接收输入将不会有问题。

I know precisely nothing about InnoSetup but surely you need to use ShowModal rather than Show here. Installation UI is invariably modal and what you want here is to wait until the user has finished iteracting with the form before you return to Inno. Otherwise, how would Inno know when to proceed? ShowModal runs a message loop to service the form so there will be no problems receiving input.

您还将更改DLL以删除DestroyWizardForm,因为调用ShowModal的函数既可以创建并销毁表单。

You would also change your DLL to remove DestroyWizardForm since the function that calls ShowModal can both create and destroy the form.

这篇关于InnoSetup:可以打开我的自定义Delphi窗体(从DLL)而不是标准设置向导的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆