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

梦想的初衷 提交于 2019-12-03 15:50:07

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.

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

In my setup I do something similar. InnoSetup code I pass the handle as StrToInt(ExpandConstant('{wizardhwnd}')) (my guess is that MainForm.Handle is zero)

in the 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;

If you want to entirely replace the UI, it will probably be easier to create a stub application that presents the form then runs the normal setup in silent mode passing various command line parameters.

Either that or at the very least, using Inno's native form and wizard page functions/logic.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!