在Inno Setup窗口中打开外部程序

时间:2019-03-11 06:23:09

标签: inno-setup

我有一些Exe格式的动画,我需要将它们加载到Inno Setup的面板中。

我发现了有关Delphi的这些信息:
http://www.delphipages.com/forum/archive/index.php/t-200729.html
How to shell to another app and have it appear in a delphi form

如何在Inno Setup中实现此类功能?

1 个答案:

答案 0 :(得分:1)

Inno Setup的等效代码如下:

[Code]

function SetParent(hWndChild: HWND; hWndNewParent: HWND): HWND;
  external 'SetParent@User32.dll stdcall';
function ShowWindow(hWnd: HWND; nCmdShow: Integer): BOOL;
  external 'ShowWindow@User32.dll stdcall';

procedure InitializeWizard();
var
  Page: TWizardPage;
  ResultCode: Integer;
  ProgHandle: HWND;
begin
  Page := CreateCustomPage(wpWelcome, 'Test', '');

  Exec('notepad.exe', '', '', SW_HIDE, ewNoWait, ResultCode);

  while ProgHandle = 0 do
    ProgHandle := FindWindowByWindowName('Untitled - Notepad');

  SetParent(ProgHandle, Page.Surface.Handle);
  ShowWindow(ProgHandle, SW_SHOWMAXIMIZED);
end;

enter image description here